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'.
This commit is contained in:
Marc Burns 2012-09-23 03:11:06 -04:00 committed by Eli Barzilay
parent cb42b7ed6a
commit fa0336bfad

View File

@ -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)])