Skip to content

Commit

Permalink
Check URI is relative before processing as relative
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbreese committed Jun 19, 2022
1 parent 1158b00 commit 2dea84d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ public bool TryParseMessage(in ReadOnlySequence<byte> input, ref SequencePositio
return false;
}

//First char must be / for relative URI
if (path[0] == (byte)'/')
{
_httpRequestMessage.RequestUri = new Uri(Encoding.ASCII.GetString(path), UriKind.Relative);
}
else
{
_httpRequestMessage.RequestUri = new Uri(Encoding.ASCII.GetString(path));
}
_httpRequestMessage.Method = new HttpMethod(Encoding.ASCII.GetString(method));
_httpRequestMessage.RequestUri = new Uri(Encoding.ASCII.GetString(path), UriKind.Relative);
_httpRequestMessage.Version = new Version(1, 1);
// Version = Encoding.ASCII.GetString(version.IsSingleSegment ? version.FirstSpan : version.ToArray());

Expand Down

0 comments on commit 2dea84d

Please sign in to comment.