Skip to content

Commit

Permalink
Fix handling of the request URI for HTTP/2.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Jul 12, 2024
1 parent a64a7b3 commit f43d6a9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/vibe/http/internal/http2/exchange.d
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ bool handleHTTP2Request(UStream)(ref HTTP2ConnectionStream!UStream stream,
req.host = tcp_connection.localAddress.toString;
}

if(req.tls) req.requestURI = "https://" ~ req.host ~ req.path;
else req.requestURI = "http://" ~ req.host ~ req.path;

string reqhost;
ushort reqport = 0;
{
Expand Down Expand Up @@ -689,15 +686,19 @@ void parseHTTP2RequestHeader(R)(ref R headers, HTTPServerRequest req) @safe
if(!host.empty) req.host = cast(string)host[0].value;

//Path
req.requestPath = InetPath(cast(string)headers.find!((h,m) => h.name == m)(":path")[0].value);
auto pathstr = cast(string)headers.find!((h,m) => h.name == m)(":path")[0].value;
if(req.tls) req.requestURI = "https://" ~ req.host ~ pathstr;
else req.requestURI = "http://" ~ req.host ~ pathstr;

//URI
req.requestURI = req.host;
auto url = URL.parse(req.requestURI);
req.queryString = url.queryString;
req.username = url.username;
req.password = url.password;
req.requestPath = url.path;

//HTTP version
req.httpVersion = HTTPVersion.HTTP_2;


//headers
foreach(h; headers.filter!(f => !f.name.startsWith(":"))) {
req.headers[h.name] = cast(string)h.value;
Expand Down

0 comments on commit f43d6a9

Please sign in to comment.