This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base on RFC 3986, ensure following characters are not encoded alpha, digit, "-", "_", ".", "~", "@", ":", "/", "!", "$", ";", "=", "'", "(", ")", "*", "+", ","
- Loading branch information
Showing
3 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/Microsoft.AspNetCore.Http.Abstractions/Internal/PathStringHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.AspNetCore.Http.Internal | ||
{ | ||
internal class PathStringHelper | ||
{ | ||
private static bool[] ValidPathChars = { | ||
false, false, false, false, false, false, false, false, // 0x00 - 0x07 | ||
false, false, false, false, false, false, false, false, // 0x08 - 0x0F | ||
false, false, false, false, false, false, false, false, // 0x10 - 0x17 | ||
false, false, false, false, false, false, false, false, // 0x18 - 0x1F | ||
false, true, false, false, true, false, true, true, // 0x20 - 0x27 | ||
true, true, true, true, true, true, true, true, // 0x28 - 0x2F | ||
true, true, true, true, true, true, true, true, // 0x30 - 0x37 | ||
true, true, true, true, false, true, false, false, // 0x38 - 0x3F | ||
true, true, true, true, true, true, true, true, // 0x40 - 0x47 | ||
true, true, true, true, true, true, true, true, // 0x48 - 0x4F | ||
true, true, true, true, true, true, true, true, // 0x50 - 0x57 | ||
true, true, true, false, false, false, false, true, // 0x58 - 0x5F | ||
false, true, true, true, true, true, true, true, // 0x60 - 0x67 | ||
true, true, true, true, true, true, true, true, // 0x68 - 0x6F | ||
true, true, true, true, true, true, true, true, // 0x70 - 0x77 | ||
true, true, true, false, false, false, true, false, // 0x78 - 0x7F | ||
}; | ||
|
||
public static bool IsValidPathChar(char c) | ||
{ | ||
return c < ValidPathChars.Length && ValidPathChars[c]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters