From fa0336bfad13deaff86a6bf5577a27a53abbd989 Mon Sep 17 00:00:00 2001 From: Marc Burns Date: Sun, 23 Sep 2012 03:11:06 -0400 Subject: [PATCH] Call `close-output-port' on abandoned port in `ssl-abandon-port'. This change causes the abandoned output port to be properly shutdown, when the `shutdown-on-close' option is set, and decrements the mzssl struct reference count when a port is abandoned. Previously, the `*-[im]pure-port' methods from `net/url' would fail to close the SSL socket associated with the connection when `close-input-port' was called on the port object returned. This patch causes the underlying socket to be closed when `close-input-port' is called on SSL-based ports returned by functions in `net/url'. --- collects/openssl/mzssl.rkt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/collects/openssl/mzssl.rkt b/collects/openssl/mzssl.rkt index f98b61e013..e99a9f5ed9 100644 --- a/collects/openssl/mzssl.rkt +++ b/collects/openssl/mzssl.rkt @@ -1067,7 +1067,9 @@ (let-values ([(mzssl input?) (lookup 'ssl-abandon-port "(and/c ssl-port? output-port?)" p)]) (when input? (raise-argument-error 'ssl-abandon-port "(and/c ssl-port? output-port?)" p)) - (set-mzssl-shutdown-on-close?! mzssl #f))) + (set-mzssl-shutdown-on-close?! mzssl #f) + ;; Call close-output-port to flush, shutdown, and decrement mzssl refcount. + (close-output-port p))) (define (ssl-peer-verified? p) (let-values ([(mzssl input?) (lookup 'ssl-peer-verified? "ssl-port?" p)])