diff options
author | Martin Björklund <[email protected]> | 2021-04-19 20:03:57 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2022-03-08 15:24:00 +0100 |
commit | 1ee2a1913e79e010733991d8373b2517abf0d91b (patch) | |
tree | f8c9d1876a3eb83d416d3d77bbf31053d6a0bec6 /src | |
parent | 56cbf3823331a56474248541987c9b9d13c452d4 (diff) | |
download | gun-1ee2a1913e79e010733991d8373b2517abf0d91b.tar.gz gun-1ee2a1913e79e010733991d8373b2517abf0d91b.tar.bz2 gun-1ee2a1913e79e010733991d8373b2517abf0d91b.zip |
Handle any zero-sized Data in http:data with fin
Amended to make the test case hit the problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/gun_http.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index d928b18..b38cc74 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -692,10 +692,10 @@ data(State=#http_state{socket=Socket, transport=Transport, version=Version, DataLength = iolist_size(Data), case Out of body_chunked when Version =:= 'HTTP/1.1', IsFin =:= fin -> - case Data of - <<>> -> + if + DataLength =:= 0 -> Transport:send(Socket, cow_http_te:last_chunk()); - _ -> + true -> Transport:send(Socket, [ cow_http_te:chunk(Data), cow_http_te:last_chunk() |