net/url: fix problems with new implementation on net/http-client

Various `net/url` operations need to request a close of the
connection after the operation completes, and `het/http-client`
needs to actually close the input-port half of a connection.

Also, add `http-conn-abandon!`.

Also also, add limits on internal pipes, so that data doesn't pile
up in a connection-processing thread, and fix POST/PUT by adding
a needed CRLF after posted data.

original commit: 0dcaa5e19f
This commit is contained in:
Matthew Flatt 2013-08-30 10:37:09 -06:00
parent 8dfb089fc2
commit b4613332a3
2 changed files with 16 additions and 7 deletions

View File

@ -61,6 +61,13 @@ Closes @racket[hc] if it is live.
}
@defproc[(http-conn-abandon! [hc http-conn?])
void?]{
Closes the output side of @racket[hc], if it is live.
}
@defproc[(http-conn-send! [hc http-conn-live?] [uri (or/c bytes? string?)]
[#:version version (or/c bytes? string?) #"1.1"]
[#:method method (or/c bytes? string? symbol?) #"GET"]

View File

@ -151,12 +151,14 @@
(module+ main (tests))
(define (tests)
(test
(run-tests "http" values #f)
(for ([i 100]) ; repeat to catch port leaks
(run-tests "http" values #f))
(for ([i 100])
(run-tests "https" (let ([ctx (ssl-make-server-context)])
(ssl-load-certificate-chain! ctx (collection-file-path "test.pem" "openssl"))
(ssl-load-private-key! ctx (collection-file-path "test.pem" "openssl"))
(lambda (in out)
(ports->ssl-ports in out #:mode 'accept #:context ctx)))
#t)))
#t))))
(module+ test (require (submod ".." main))) ; for raco test & drdr