Skip to content

Commit

Permalink
Fix invalid utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed May 9, 2023
1 parent 900b431 commit 9c24b11
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/serverino/worker.d
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,17 @@ struct Worker
request._internal._uri = normalize(matches[5]);
request._internal._rawQueryString = matches[7];
request._internal._method = method.to!string;
request._internal.process();

import std.uri : URIException;
try { request._internal.process(); }
catch (URIException e)
{
output._internal._httpVersion = (httpVersion == "HTTP/1.1")?(HttpVersion.HTTP11):(HttpVersion.HTTP10);
output._internal._keepAlive = false;
output.status = 400;
output ~= "400 Bad Request";
return false;
}

output._internal._httpVersion = request._internal._httpVersion;

Expand Down

0 comments on commit 9c24b11

Please sign in to comment.