benoitc / hackney

simple HTTP client in Erlang
Other
1.34k stars 427 forks source link

:hackney_url.pathencode should use uppercase hex #665

Closed smanolloff closed 3 years ago

smanolloff commented 3 years ago

According to RFC3986:

The uppercase hexadecimal digits 'A' through 'F' are equivalent to the lowercase digits 'a' through 'f', respectively. If two URIs differ only in the case of hexadecimal digits used in percent-encoded octets, they are equivalent. For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent- encodings.

Since it is recommended to use upper-case, it's better to also do it here.

benoitc commented 3 years ago

Good catch.

That change is tricky to handle though at it my break some application relying on urls consistency or sort of by hashing them. The implementation will be done this way:

benoitc commented 3 years ago

implemented via #671 . I decided to just make it the default in urlencode and produce uppercase using pathencode. The change will be documented as a braking change in the changelog.

benoitc commented 3 years ago

fixed in master. Thanks for the ticket!