diff options
author | Loïc Hoguin <[email protected]> | 2015-04-12 21:26:39 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-04-12 21:27:22 +0300 |
commit | d5038d46a7546ff6f37fddfa097e1b595bc13f82 (patch) | |
tree | fdf7c1be2e9e690e9ec6fdbce0e1a285d2ac1321 /src/gun_http.erl | |
parent | 085b240d2203714c35c999fe2609b47041dbb1fb (diff) | |
download | gun-d5038d46a7546ff6f37fddfa097e1b595bc13f82.tar.gz gun-d5038d46a7546ff6f37fddfa097e1b595bc13f82.tar.bz2 gun-d5038d46a7546ff6f37fddfa097e1b595bc13f82.zip |
Add a SPDY test and improve a few badstate messages
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r-- | src/gun_http.erl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index 67c235f..1090e6b 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -241,11 +241,11 @@ request(State=#http_state{socket=Socket, transport=Transport, version=Version, new_stream(State#http_state{connection=Conn}, StreamRef). %% We are expecting a new stream. -data(State=#http_state{out=head}, _, _, _) -> - error_stream_closed(State); +data(State=#http_state{out=head}, StreamRef, _, _) -> + error_stream_closed(State, StreamRef); %% There are no active streams. -data(State=#http_state{streams=[]}, _, _, _) -> - error_stream_not_found(State); +data(State=#http_state{streams=[]}, StreamRef, _, _) -> + error_stream_not_found(State, StreamRef); %% We can only send data on the last created stream. data(State=#http_state{socket=Socket, transport=Transport, version=Version, out=Out, streams=Streams}, StreamRef, IsFin, Data) -> @@ -280,7 +280,7 @@ data(State=#http_state{socket=Socket, transport=Transport, version=Version, State end; {_, _} -> - error_stream_not_found(State) + error_stream_not_found(State, StreamRef) end. %% We can't cancel anything, we can just stop forwarding messages to the owner. @@ -289,7 +289,7 @@ cancel(State, StreamRef) -> true -> cancel_stream(State, StreamRef); false -> - error_stream_not_found(State) + error_stream_not_found(State, StreamRef) end. %% HTTP does not provide any way to figure out what streams are unprocessed. @@ -300,13 +300,13 @@ down(#http_state{streams=Streams}) -> end || {Ref, _} <- Streams], {KilledStreams, []}. -error_stream_closed(State=#http_state{owner=Owner}) -> - Owner ! {gun_error, self(), {badstate, +error_stream_closed(State=#http_state{owner=Owner}, StreamRef) -> + Owner ! {gun_error, self(), StreamRef, {badstate, "The stream has already been closed."}}, State. -error_stream_not_found(State=#http_state{owner=Owner}) -> - Owner ! {gun_error, self(), {badstate, +error_stream_not_found(State=#http_state{owner=Owner}, StreamRef) -> + Owner ! {gun_error, self(), StreamRef, {badstate, "The stream cannot be found."}}, State. |