public static string DecodeAndUnescapePath(Span <byte> rawUrlBytes) { Debug.Assert(rawUrlBytes.Length > 0, "Length of the URL cannot be zero."); var rawPath = RawUrlHelper.GetPath(rawUrlBytes); if (rawPath.Length == 0) { return("/"); } var unescapedPath = Unescape(rawPath); return(UTF8.GetString(unescapedPath)); }
public static string DecodeAndUnescapePath(Span <byte> rawUrlBytes) { Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero."); var rawPath = RawUrlHelper.GetPath(rawUrlBytes); if (rawPath.Length == 0) { return("/"); } var unescapedPath = Unescape(rawPath); var length = PathNormalizer.RemoveDotSegments(unescapedPath); return(UTF8.GetString(unescapedPath.Slice(0, length))); }
public static string DecodeAndUnescapePath(byte[] rawUrlBytes) { if (rawUrlBytes == null) { throw new ArgumentNullException(nameof(rawUrlBytes)); } if (rawUrlBytes.Length == 0) { throw new ArgumentException("Length of the URL cannot be zero.", nameof(rawUrlBytes)); } var rawPath = RawUrlHelper.GetPath(rawUrlBytes); var unescapedPath = Unescape(rawPath); return(UTF8.GetString(unescapedPath.Array, unescapedPath.Offset, unescapedPath.Count)); }
public static string DecodeAndUnescapePath(Span <byte> rawUrlBytes) { Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero."); var rawPath = RawUrlHelper.GetPath(rawUrlBytes); if (rawPath.Length == 0) { return("/"); } // OPTIONS * // RemoveDotSegments Asserts path always starts with a '/' if (rawPath.Length == 1 && rawPath[0] == (byte)'*') { return("*"); } var unescapedPath = Unescape(rawPath); var length = PathNormalizer.RemoveDotSegments(unescapedPath); return(UTF8.GetString(unescapedPath.Slice(0, length))); }