Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

PathString over-encodes #660

Closed
Tratcher opened this issue Jun 27, 2016 · 2 comments
Closed

PathString over-encodes #660

Tratcher opened this issue Jun 27, 2016 · 2 comments
Assignees

Comments

@Tratcher
Copy link
Member

Tratcher commented Jun 27, 2016

Ported from https://katanaproject.codeplex.com/workitem/462

"The resource path delimiters "(" and ")" are encoded which violates RFC 3986. Please see section 3.3. This breaks a lot of OData clients that rely on a specific URL convention. The offending code can be found in Microsoft.Owin.PathString:ToUriComponent().

http://services.odata.org/OData/OData.svc/GetProductsByCategoryId(categoryId=2)
is encoded as
http://services.odata.org/OData/OData.svc/GetProductsByCategoryId%28categoryId=2%29
which is incorrect."

AspNetCore uses a different encoder, but it likely has similar behaviors here.
https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNetCore.Http.Abstractions/PathString.cs#L67

pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="
pct-encoded   = "%" HEXDIG HEXDIG
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
@Tratcher Tratcher added the bug label Jun 27, 2016
@muratg muratg added this to the 1.0.1 milestone Jun 28, 2016
@troydai
Copy link
Contributor

troydai commented Jul 6, 2016

Here's a prototype: https://github.com/troydai/HttpAbstractions660/blob/master/PrototypeEncoder.cs

Category: unreserved
     Input: /abc123.-_~
PathString: /abc123.-_~
 Prototype: /abc123.-_~

  Category: colon
     Input: /:
PathString: /%3A
 Prototype: /:

  Category: at
     Input: /@
PathString: /@
 Prototype: /@

  Category: sub-delims
     Input: /!$&'()*+,;=
PathString: /!$%26%27()*%2B,;%3D
 Prototype: /!$&'()*+,;=

  Category: reserved
     Input: /?#[]
PathString: /%3F%23%5B%5D
 Prototype: /%3F%23%5B%5D

  Category: pct-encoding
     Input: /单行道
PathString: /%E5%8D%95%E8%A1%8C%E9%81%93
 Prototype: /%E5%8D%95%E8%A1%8C%E9%81%93

  Category: mixed
     Input: /index/单行道=(x*y)
PathString: /index/%E5%8D%95%E8%A1%8C%E9%81%93%3D(x*y)
 Prototype: /index/%E5%8D%95%E8%A1%8C%E9%81%93=(x*y)

@troydai
Copy link
Contributor

troydai commented Jul 8, 2016

Fixed in 150b470

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants