ninenines / gun

HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
ISC License
891 stars 232 forks source link

Host header with IPv6 address in square brackets #223

Closed zuiderkwast closed 4 years ago

zuiderkwast commented 4 years ago

In case the host is an IPv6 address, the I believe the host header should have the IPv6 address wrapped in square brackets ([, ]). The same goes for the :authority pseudo header.

I have located the problem to gun_http:host_header/3 which doesn't add the square brackets after calling inet:ntoa/1. Possibly it suffices to add a case clause for Tuple when tuple_size(Tuple) == 8 for IPv6 and add the brackets there.

The function for reference: https://github.com/ninenines/gun/blob/master/src/gun_http.erl#L605

essen commented 4 years ago

Yes.

essen commented 4 years ago

Fixed in most recent commit. Thanks!