From 342bcc5834e47bf531f90a4aae4f758d30bffffd Mon Sep 17 00:00:00 2001 From: Unix1 Date: Sun, 8 Jun 2014 08:13:16 -0700 Subject: close when handling response with no streams for extend/gun#15 --- src/gun_http.erl | 3 +++ 1 file changed, 3 insertions(+) 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 >>, -- cgit v1.2.3