File tree 2 files changed +23
-7
lines changed
2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ where's my kibble?}]
69
69
70
70
system/options/log/smtp: 2
71
71
72
- bufsize: 32000 ;-- use a write buffer of 32k for sending large attachments
72
+ bufsize: 16384 ;-- use a write buffer of 16KiB (maximum TLS record size!) for sending large attachments
73
73
74
74
mail-obj: make object! [
75
75
from:
@@ -320,7 +320,7 @@ sync-smtp-handler: function [event][
320
320
switch /default state [
321
321
SENDING [
322
322
either not empty? ptr: smtp-ctx/mail/message [
323
- sys/log/debug 'SMTP ["Sending " min bufsize length? ptr " bytes of " length? ptr ]
323
+ sys/log/more 'SMTP ["Sending" min bufsize length? ptr "bytes of" length? ptr ]
324
324
write client to binary! take/part ptr bufsize
325
325
][
326
326
sys/log/debug 'SMTP "Sending ends."
@@ -478,6 +478,8 @@ sys/make-scheme [
478
478
close port
479
479
wait [port 0.1 ]
480
480
do error
481
+ port/state: 'ERROR
482
+ true
481
483
]
482
484
close [
483
485
port/state: 'CLOSE
Original file line number Diff line number Diff line change @@ -2145,10 +2145,23 @@ TLS-client-awake: function [event [event!]][
2145
2145
return true
2146
2146
]
2147
2147
error [
2148
- if all [ctx ctx/state = 'lookup][
2149
- ctx/error: make error! [
2150
- code: 500 type: 'access id: 'cannot-open
2151
- arg1: TCP-port/spec/ref
2148
+ unless ctx/error [
2149
+ ctx/error: case [
2150
+ ctx/state = 'lookup [
2151
+ make error! [
2152
+ code: 500 type: 'access id: 'cannot-open
2153
+ arg1: TCP-port/spec/ref
2154
+ ]
2155
+ ]
2156
+ 'else [
2157
+ ;@@ needs better error (unknown reason)
2158
+ ; So far this error is used, when we try to write
2159
+ ; application data larger than 16KiB!
2160
+ make error! [
2161
+ code: 500 type: 'access id: 'protocol
2162
+ arg1: TCP-port/spec/ref
2163
+ ]
2164
+ ]
2152
2165
]
2153
2166
]
2154
2167
send-event 'error TLS-port
@@ -2284,7 +2297,8 @@ do-TLS-write: func[port [port!] value [any-type!] /local ctx][
2284
2297
log-debug "WRITE"
2285
2298
ctx: port/extra
2286
2299
if ctx/protocol = 'APPLICATION [
2287
-
2300
+ ;@@ FIXME: size limit for application data is 16KiB,
2301
+ ;@@ else server closes connection, which is not detected!
2288
2302
binary/init ctx/out none ;resets the output buffer
2289
2303
application-data ctx :value
2290
2304
You can’t perform that action at this time.
0 commit comments