shelf icon indicating copy to clipboard operation
shelf copied to clipboard

Colon in path throws ArgumentError

Open jonasfj opened this issue 5 years ago • 2 comments
trafficstars

Throws in: https://github.com/dart-lang/shelf/blob/fbc691a595f16d983d6e44efc9b5efbc9003645c/lib/src/request.dart#L178-L184

Because _computeUrl returns a URI with a relative path in: https://github.com/dart-lang/shelf/blob/fbc691a595f16d983d6e44efc9b5efbc9003645c/lib/src/request.dart#L318-L320

From https://tools.ietf.org/html/rfc3986#section-3.3

In addition, a URI reference (Section 4.1) may be a relative-path reference, in which case the first path segment cannot contain a colon (":") character.

Hence, we see that Uri(path: 'a:a').path is URL-encoded, because it's a relative URL and not absolute URL unlike requestedUri which is absolute, hence, colon is not encoded in requestedUri.path, and we get an ArgumentError.

jonasfj avatar Feb 25 '20 14:02 jonasfj

Filed a PR in https://github.com/dart-lang/shelf/pull/130

jonasfj avatar Apr 29 '20 09:04 jonasfj

this bug has been fixed?

Silentdoer avatar Dec 13 '21 23:12 Silentdoer