diff options
author | Loïc Hoguin <[email protected]> | 2019-09-26 19:31:45 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-26 19:31:45 +0200 |
commit | 069040a93bb88477dcae197fa14280a10cce72d8 (patch) | |
tree | e842ae85e04559579812ef7d7ea004d1e896ceae /src | |
parent | e7dd9f227e46979d8073e71c683395a809b78cb4 (diff) | |
download | gun-069040a93bb88477dcae197fa14280a10cce72d8.tar.gz gun-069040a93bb88477dcae197fa14280a10cce72d8.tar.bz2 gun-069040a93bb88477dcae197fa14280a10cce72d8.zip |
Gun 1.3.11.3.1
Diffstat (limited to 'src')
-rw-r--r-- | src/gun_http.erl | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index e2b37d1..abd4fc5 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -519,22 +519,20 @@ response_io_from_headers(<<"HEAD">>, _, _, _) -> response_io_from_headers(_, _, Status, _) when (Status =:= 204) or (Status =:= 304) -> head; response_io_from_headers(_, Version, _Status, Headers) -> - case lists:keyfind(<<"content-length">>, 1, Headers) of - {_, <<"0">>} -> - head; - {_, Length} -> - {body, cow_http_hd:parse_content_length(Length)}; - _ when Version =:= 'HTTP/1.0' -> - body_close; + case lists:keyfind(<<"transfer-encoding">>, 1, Headers) of + {_, TE} when Version =:= 'HTTP/1.1' -> + case cow_http_hd:parse_transfer_encoding(TE) of + [<<"chunked">>] -> body_chunked; + [<<"identity">>] -> body_close + end; _ -> - case lists:keyfind(<<"transfer-encoding">>, 1, Headers) of - false -> - body_close; - {_, TE} -> - case cow_http_hd:parse_transfer_encoding(TE) of - [<<"chunked">>] -> body_chunked; - [<<"identity">>] -> body_close - end + case lists:keyfind(<<"content-length">>, 1, Headers) of + {_, <<"0">>} -> + head; + {_, Length} -> + {body, cow_http_hd:parse_content_length(Length)}; + _ -> + body_close end end. |