Open fp opened 7 years ago
Yes I know: https://github.com/ninenines/cowlib/blob/master/src/cow_http_hd.erl#L1897
I didn't have the appropriate function at the time. It's now available in cow_uri
. A patch should be straightforward.
Completely missed that comment! If it is safe to have reg_name/2
allow percent-encoding, I can produce a PR if that will help.
It's safe. We currently just reject completely. Make sure you include tests, and double check if there's any considerations with regard to a percent encoded :
or port.
According to RFC 7230, section 5.4, the
host
header should accept:and
uri-host
is defined to be:which in RFC3986, section 3.2.2 is defined to be:
and as a result
cow_http_hd:reg_name/2
should accept url encoded values.A patched hackney trace shows this being rejected by the current code in cowboy master: