aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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 =