Compare commits

...

2 Commits

Author SHA1 Message Date
Andrew Lalis 905e3f93f8 Upgrade primitives to 1.6
Build and Test Module / build-and-test (push) Successful in 12s Details
2025-03-26 14:34:41 -04:00
Andrew Lalis c2cd2cfc5c upgraded dependencies
Build and Test Module / build-and-test (push) Successful in 11s Details
2025-03-23 20:03:55 -04:00
3 changed files with 11 additions and 5 deletions

View File

@ -4,9 +4,9 @@
],
"copyright": "Copyright © 2024, Andrew Lalis",
"dependencies": {
"handy-http-primitives": "~>1.2",
"handy-http-primitives": "~>1.6",
"photon": "~>0.10",
"streams": "~>3.5"
"streams": "~>3.6"
},
"description": "Implementations of HTTP transport protocols.",
"license": "CC0",

View File

@ -1,9 +1,9 @@
{
"fileVersion": 1,
"versions": {
"handy-http-primitives": "1.2.0",
"handy-http-primitives": "1.6.0",
"photon": "0.10.2",
"sharded-map": "2.7.0",
"streams": "3.5.0"
"streams": "3.6.0"
}
}

View File

@ -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)
));
}