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.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 204ce4a..3837bb3 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -174,6 +174,9 @@ handle_head(Data, State=#http_state{version=ClientVersion,
case {Status, StreamRef} of
{101, {websocket, _, WsKey, WsExtensions, WsOpts}} ->
ws_handshake(Rest2, State, Headers, WsKey, WsExtensions, WsOpts);
+ {_, _} when Status >= 100, Status =< 199 ->
+ ReplyTo ! {gun_inform, self(), stream_ref(StreamRef), Status, Headers},
+ handle(Rest2, State);
_ ->
In = response_io_from_headers(Method, Version, Status, Headers),
IsFin = case In of head -> fin; _ -> nofin end,
@@ -181,11 +184,7 @@ handle_head(Data, State=#http_state{version=ClientVersion,
false ->
ok;
true ->
- StreamRef2 = case StreamRef of
- {websocket, SR, _, _, _} -> SR;
- _ -> StreamRef
- end,
- ReplyTo ! {gun_response, self(), StreamRef2,
+ ReplyTo ! {gun_response, self(), stream_ref(StreamRef),
IsFin, Status, Headers},
case IsFin of
fin -> undefined;
@@ -215,6 +214,9 @@ handle_head(Data, State=#http_state{version=ClientVersion,
end
end.
+stream_ref({websocket, StreamRef, _, _, _}) -> StreamRef;
+stream_ref(StreamRef) -> StreamRef.
+
send_data_if_alive(<<>>, State, nofin) ->
State;
%% @todo What if we receive data when the HEAD method was used?