diff options
author | Loïc Hoguin <[email protected]> | 2015-08-16 23:00:39 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-08-16 23:00:39 +0200 |
commit | 2722eca9048f990bd5e8d247d9dc2620320c6020 (patch) | |
tree | 6812f84829373d54820975e0cbb42551172d6ef3 | |
parent | b4a205b17bd4d72c0880e8143bb1ff638b19986c (diff) | |
download | gun-2722eca9048f990bd5e8d247d9dc2620320c6020.tar.gz gun-2722eca9048f990bd5e8d247d9dc2620320c6020.tar.bz2 gun-2722eca9048f990bd5e8d247d9dc2620320c6020.zip |
Handle 204 responses properly
Thanks @petrohi for the initial patch.
-rw-r--r-- | src/gun_http.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index 12fb83c..b1ac4ad 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -147,7 +147,7 @@ handle_head(Data, State=#http_state{owner=Owner, version=ClientVersion, {101, {websocket, _, WsKey, WsExtensions, WsProtocols, WsOpts}} -> ws_handshake(Rest2, State, Headers, WsKey, WsExtensions, WsProtocols, WsOpts); _ -> - In = response_io_from_headers(Version, Headers), + In = response_io_from_headers(Version, Status, Headers), IsFin = case In of head -> fin; _ -> nofin end, case IsAlive of false -> @@ -343,7 +343,9 @@ request_io_from_headers(Headers) -> end end. -response_io_from_headers(Version, Headers) -> +response_io_from_headers(_, 204, _) -> + head; +response_io_from_headers(Version, Status, Headers) -> case lists:keyfind(<<"content-length">>, 1, Headers) of {_, <<"0">>} -> head; |