Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Do not unescape forward slashes in the request path (#146). #161

Merged
merged 1 commit into from
Dec 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"projects": ["src"]
"projects": ["src", "test"]
}
24 changes: 5 additions & 19 deletions src/Microsoft.Net.Http.Server/RequestProcessing/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,21 @@ internal unsafe Request(RequestContext httpContext, NativeRequestContext memoryB
}

UrlPrefix prefix = httpContext.Server.UrlPrefixes.GetPrefix((int)_contextId);
string orriginalPath = RequestPath;
string originalPath = RequestPath;

// These paths are both unescaped already.
if (orriginalPath.Length == prefix.Path.Length - 1)
if (originalPath.Length == prefix.Path.Length - 1)
{
// They matched exactly except for the trailing slash.
_pathBase = orriginalPath;
_pathBase = originalPath;
_path = string.Empty;
}
else
{
// url: /base/path, prefix: /base/, base: /base, path: /path
// url: /, prefix: /, base: , path: /
_pathBase = orriginalPath.Substring(0, prefix.Path.Length - 1);
_path = orriginalPath.Substring(prefix.Path.Length - 1);
_pathBase = originalPath.Substring(0, prefix.Path.Length - 1);
_path = originalPath.Substring(prefix.Path.Length - 1);
}

int major = memoryBlob.RequestBlob->Version.MajorVersion;
Expand Down Expand Up @@ -386,21 +386,7 @@ public string Scheme
{
get { return IsSecureConnection ? Constants.HttpsScheme : Constants.HttpScheme; }
}
/*
internal Uri RequestUri
{
get
{
if (_requestUri == null)
{
_requestUri = RequestUriBuilder.GetRequestUri(
_rawUrl, RequestScheme, _cookedUrlHost, _cookedUrlPath, _cookedUrlQuery);
}

return _requestUri;
}
}
*/
internal string RequestPath
{
get
Expand Down
Loading