aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnix1 <[email protected]>2014-06-08 08:13:16 -0700
committerUnix1 <[email protected]>2014-06-09 07:07:28 -0700
commit342bcc5834e47bf531f90a4aae4f758d30bffffd (patch)
tree2b9f415bd1abdb6c5e63344cf8c1941434c4f3b6
parent5df930c2f4ee360e3a30e5ee644e9d573b5ca153 (diff)
downloadgun-342bcc5834e47bf531f90a4aae4f758d30bffffd.tar.gz
gun-342bcc5834e47bf531f90a4aae4f758d30bffffd.tar.bz2
gun-342bcc5834e47bf531f90a4aae4f758d30bffffd.zip
close when handling response with no streams for extend/gun#15
-rw-r--r--src/gun_http.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 46f5a53..5af1b12 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -47,6 +47,9 @@ init(Owner, Socket, Transport, [{version, Version}]) ->
#http_state{owner=Owner, socket=Socket, transport=Transport,
version=Version}.
+%% Close when server responds and we don't have any open streams.
+handle(_, #http_state{streams=[]}) ->
+ close;
%% Wait for the full response headers before trying to parse them.
handle(Data, State=#http_state{in=head, buffer=Buffer}) ->
Data2 = << Buffer/binary, Data/binary >>,