Skip to content

Commit a639131

Browse files
committed
FEAT: SMTP protocol scheme updated to work with the recent TLS changes
1 parent 3f38fcf commit a639131

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/mezz/prot-smtp.reb

+9-12
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ sync-smtp-handler: function [event][
135135
]
136136
connect [
137137
smtp-port/state: 'EHLO
138-
read client
138+
either state = 'STARTTLS [
139+
sys/log/more 'SMTP "TLS connection established..."
140+
write smtp-ctx/connection to binary! net-log/C ajoin ["EHLO " spec/ehlo CRLF]
141+
smtp-port/state: 'AUTH
142+
][
143+
read client
144+
]
139145
false
140146
]
141147

@@ -210,21 +216,12 @@ sync-smtp-handler: function [event][
210216

211217
STARTTLS [
212218
if code = 220 [
213-
;- Upgrading client's connection to TLS port
219+
sys/log/more 'SMTP "Upgrading client's connection to TLS port"
214220
;; tls-port will be a new layer between existing smtp and client (tcp) connections
215-
;? client
216-
;? smtp-port
217221
tls-port: open [scheme: 'tls conn: client]
218222
tls-port/parent: smtp-port
219223
client/parent: tls-port
220-
sys/log/more 'SMTP "TLS connection established..."
221-
;? tls-port
222-
;? client
223-
;? client/parent
224-
;? client/extra/tls-port
225-
smtp-port/extra/connection: client/extra/tls-port
226-
write tls-port to binary! net-log/C ajoin ["EHLO " spec/ehlo CRLF]
227-
smtp-port/state: 'AUTH
224+
smtp-ctx/connection: client/extra/tls-port
228225
return false
229226
]
230227
]

0 commit comments

Comments
 (0)