aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergey Tupchiy <[email protected]>2019-03-13 16:12:13 +0200
committerLoïc Hoguin <[email protected]>2019-04-25 10:33:45 +0200
commit57abad2d59323e64144246a9af6ce0fc91711a6f (patch)
tree61b61e67cbc502a48463b32748b09f4a2877d5b9 /src
parentc35d399138e99d3615a3ceac40a2440030d9a2ef (diff)
downloadgun-57abad2d59323e64144246a9af6ce0fc91711a6f.tar.gz
gun-57abad2d59323e64144246a9af6ce0fc91711a6f.tar.bz2
gun-57abad2d59323e64144246a9af6ce0fc91711a6f.zip
Fix Websocket upgrade host header when it's an IP address
Diffstat (limited to 'src')
-rw-r--r--src/gun_http.erl5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 02344ee..ca04b10 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -617,12 +617,9 @@ ws_upgrade(State=#http_state{socket=Socket, transport=Transport, owner=Owner, ou
{<<"sec-websocket-key">>, Key}
|Headers2
],
- IsSecure = Transport =:= gun_tls,
Headers = case lists:keymember(<<"host">>, 1, Headers0) of
true -> Headers3;
- false when Port =:= 80, not IsSecure -> [{<<"host">>, Host}|Headers3];
- false when Port =:= 443, IsSecure -> [{<<"host">>, Host}|Headers3];
- false -> [{<<"host">>, [Host, $:, integer_to_binary(Port)]}|Headers3]
+ false -> [{<<"host">>, host_header(Transport, Host, Port)}|Headers3]
end,
Transport:send(Socket, cow_http:request(<<"GET">>, Path, 'HTTP/1.1', Headers)),
new_stream(State#http_state{connection=keepalive, out=head},