-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoded + sign in URI #55
Comments
We discovered this issue in ghcup: https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/398 Although this seems to be spec compliant:
But the spec only talks about encoding, not decoding. I'd prefer that I can have the parser fail in strict mode. |
Any news? |
uri-bytestring/src/URI/ByteString/Internal.hs Lines 916 to 944 in 1c0134c
uri-bytestring/src/URI/ByteString/Internal.hs Lines 949 to 967 in 1c0134c
unreservedPath8 :: [Word8]
unreservedPath8 = unreserved8 ++ map ord8 ":@&=+$,"
urlEncodePath :: ByteString -> Builder
urlEncodePath = urlEncode unreservedPath8
normalizeRelativeRef :: URINormalizationOptions -> Maybe Scheme -> URIRef Relative -> Builder
normalizeRelativeRef o@URINormalizationOptions {..} mScheme RelativeRef {..} =
authority <> path <> query <> fragment
where
path
| unoSlashEmptyPath && BS.null rrPath = BB.fromByteString "/"
| segs == [""] = BB.fromByteString "/"
| otherwise = mconcat (intersperse (c8 '/') (map urlEncodePath segs))
-- ... This isn't such a trivial decision either, because e.g. On the other hand, specific schemes may need more specific parsers as per RFC 3986. Looking at https://timothygu.me/urltester/#input=%2F%252B I don't see any parser decoding |
I tried finding more information about the practices with percent encoding and the + and space relationship:
What to percent encode can depend on the URI scheme, which have their own RFCs: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml The main spec says:
So we only percent encode what is not in the allowed character set. For paths, usually consisting of
So As such, I think the expected behavior should be:
I think this behavior is present in #64 |
@kozross any opinion? |
@hasufell - what does this have to do with me? |
I'd expect
to be true, but it's not. Left hand side will be
Right "/%20"
The text was updated successfully, but these errors were encountered: