From 630bd475e6aa4b9fdde01272236d08305034cb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 31 Dec 2018 17:08:59 +0100 Subject: Separate request/4,5,6 into headers/4,5 and request/5,6 This cleaner separation gets rid of the implicit body check that was causing issues for many users. Now the body is either given explicitly or it is expected via future gun:data/3 calls. --- src/gun_http.erl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/gun_http.erl') diff --git a/src/gun_http.erl b/src/gun_http.erl index 57f72c7..5229a6d 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -20,7 +20,7 @@ -export([handle/2]). -export([close/2]). -export([keepalive/1]). --export([request/8]). +-export([headers/8]). -export([request/9]). -export([data/5]). -export([connect/5]). @@ -330,7 +330,7 @@ keepalive(State=#http_state{socket=Socket, transport=Transport, out=head}) -> keepalive(State) -> State. -request(State=#http_state{socket=Socket, transport=Transport, version=Version, +headers(State=#http_state{socket=Socket, transport=Transport, version=Version, out=head}, StreamRef, ReplyTo, Method, Host, Port, Path, Headers) -> Host2 = case Host of {local, _SocketPath} -> <<>>; @@ -509,10 +509,7 @@ request_io_from_headers(Headers) -> {_, Length} -> {body, cow_http_hd:parse_content_length(Length)}; _ -> - case lists:keymember(<<"content-type">>, 1, Headers) of - true -> body_chunked; - false -> head - end + body_chunked end. response_io_from_headers(<<"HEAD">>, _, _, _) -> -- cgit v1.2.3