aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r--src/gun_http.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 401e23a..dd48c42 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -605,7 +605,8 @@ send_request(State=#http_state{socket=Socket, transport=Transport, version=Versi
host_header(Transport, Host0, Port) ->
Host = case Host0 of
{local, _SocketPath} -> <<>>;
- Tuple when is_tuple(Tuple) -> inet:ntoa(Tuple);
+ Tuple when tuple_size(Tuple) =:= 8 -> [$[, inet:ntoa(Tuple), $]]; %% IPv6.
+ Tuple when tuple_size(Tuple) =:= 4 -> inet:ntoa(Tuple); %% IPv4.
Atom when is_atom(Atom) -> atom_to_list(Atom);
_ -> Host0
end,