aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-01-02 15:08:45 +0100
committerLoïc Hoguin <[email protected]>2019-01-02 15:08:45 +0100
commit8a30f96cf19f9104e3ae8df5f85df33b66b5bfc2 (patch)
treed3e88a75756d45ab41bbf78ab8cb909107a55c2e /src
parentca0db57a30c4978f0291ef7900962ed9b8de005d (diff)
downloadgun-8a30f96cf19f9104e3ae8df5f85df33b66b5bfc2.tar.gz
gun-8a30f96cf19f9104e3ae8df5f85df33b66b5bfc2.tar.bz2
gun-8a30f96cf19f9104e3ae8df5f85df33b66b5bfc2.zip
Don't send the default port in the host header for HTTP/2
Diffstat (limited to 'src')
-rw-r--r--src/gun_http.erl3
-rw-r--r--src/gun_http2.erl7
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 29ba758..313671a 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -28,6 +28,9 @@
-export([down/1]).
-export([ws_upgrade/7]).
+%% Functions shared with gun_http2.
+-export([host_header/3]).
+
-type io() :: head | {body, non_neg_integer()} | body_close | body_chunked | body_trailer.
%% @todo Make that a record.
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index f5cf834..3d02fcf 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -268,14 +268,9 @@ request(State=#http2_state{socket=Socket, transport=Transport,
streams=[Stream|Streams]}, StreamID, fin, Body).
prepare_headers(#http2_state{transport=Transport}, Method, Host0, Port, Path, Headers0) ->
- Host1 = case Host0 of
- {local, _SocketPath} -> <<>>;
- Tuple when is_tuple(Tuple) -> inet:ntoa(Tuple);
- _ -> Host0
- end,
Authority = case lists:keyfind(<<"host">>, 1, Headers0) of
{_, Host} -> Host;
- _ -> [Host1, $:, integer_to_binary(Port)]
+ _ -> gun_http:host_header(Transport, Host0, Port)
end,
%% @todo We also must remove any header found in the connection header.
Headers =