diff options
author | Loïc Hoguin <[email protected]> | 2015-05-03 16:32:12 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-05-03 16:32:12 +0300 |
commit | 3d61f8de62eaef2aa887546bc2f2418a8c161349 (patch) | |
tree | e6c24268ba0bf0e483e81a7963b943bd3e0705bf | |
parent | a752035278b6d1b369432dbc3064bf455155059b (diff) | |
download | gun-3d61f8de62eaef2aa887546bc2f2418a8c161349.tar.gz gun-3d61f8de62eaef2aa887546bc2f2418a8c161349.tar.bz2 gun-3d61f8de62eaef2aa887546bc2f2418a8c161349.zip |
Add a missing Transfer-Encoding: chunked header in HTTP
When we stream content we need to set this header manually
from Gun.
-rw-r--r-- | src/gun_http.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index 1090e6b..c075af2 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -220,7 +220,11 @@ request(State=#http_state{socket=Socket, transport=Transport, version=Version, %% We use Headers2 because this is the smallest list. Conn = conn_from_headers(Version, Headers2), Out = request_io_from_headers(Headers2), - Transport:send(Socket, cow_http:request(Method, Path, Version, Headers3)), + Headers4 = case Out of + body_chunked -> [{<<"transfer-encoding">>, <<"chunked">>}|Headers3]; + _ -> Headers3 + end, + Transport:send(Socket, cow_http:request(Method, Path, Version, Headers4)), new_stream(State#http_state{connection=Conn, out=Out}, StreamRef). request(State=#http_state{socket=Socket, transport=Transport, version=Version, |