diff --git a/dub.json b/dub.json index dc0a359..fe49aa3 100644 --- a/dub.json +++ b/dub.json @@ -4,9 +4,9 @@ ], "copyright": "Copyright © 2024, Andrew Lalis", "dependencies": { - "handy-http-primitives": "~>1.2", + "handy-http-primitives": "~>1.5", "photon": "~>0.10", - "streams": "~>3.5" + "streams": "~>3.6" }, "description": "Implementations of HTTP transport protocols.", "license": "CC0", diff --git a/dub.selections.json b/dub.selections.json index f849e4f..d331b26 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,9 +1,9 @@ { "fileVersion": 1, "versions": { - "handy-http-primitives": "1.2.0", + "handy-http-primitives": "1.5.0", "photon": "0.10.2", "sharded-map": "2.7.0", - "streams": "3.5.0" + "streams": "3.6.0" } } diff --git a/source/handy_http_transport/http1/transport.d b/source/handy_http_transport/http1/transport.d index b6afd43..fae86d0 100644 --- a/source/handy_http_transport/http1/transport.d +++ b/source/handy_http_transport/http1/transport.d @@ -97,7 +97,10 @@ void handleClient(Socket clientSocket, HttpRequestHandler requestHandler) { stderr.writeln("Throwable error while handling request: " ~ t.msg); throw t; } - inputStream.closeStream(); + + if (response.status != HttpStatus.SWITCHING_PROTOCOLS) { + inputStream.closeStream(); + } } // Test case where we use a local socket pair to test the full handleClient @@ -194,6 +197,8 @@ HttpRequestParseResult readHttpRequest(S)(S inputStream, in ClientAddress addr) auto headersResult = parseHeaders(inputStream); if (headersResult.hasError) return HttpRequestParseResult(headersResult.error); + auto queryParams = parseQueryParameters(urlStr.value); + import std.uri : decode; // TODO: Remove dependency on phobos for this? return HttpRequestParseResult(ServerHttpRequest( @@ -202,6 +207,7 @@ HttpRequestParseResult readHttpRequest(S)(S inputStream, in ClientAddress addr) methodStr.value, decode(urlStr.value), headersResult.headers, + queryParams, inputStreamObjectFor(inputStream) )); }