aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-10-03 15:42:58 +0200
committerLoïc Hoguin <[email protected]>2019-10-03 16:04:17 +0200
commit1ba48c58b1462fb9d9d8c4d9a43878679aea8eb7 (patch)
tree989759af4f9793b7af742b33c47f1d20d4d550df /src/cowboy_http2.erl
parent57badc9082f4052f15bc3a3a432b1cfcee03c745 (diff)
downloadcowboy-1ba48c58b1462fb9d9d8c4d9a43878679aea8eb7.tar.gz
cowboy-1ba48c58b1462fb9d9d8c4d9a43878679aea8eb7.tar.bz2
cowboy-1ba48c58b1462fb9d9d8c4d9a43878679aea8eb7.zip
Make stream_error early_error reasons consistent
Now both HTTP/1.1 and HTTP/2 follow the documented format. HTTP/1.1 was including an extra element containing the StreamID before, which was unnecessary because it is also given as argument to the callback. HTTP/2 early_error will now include headers in its PartialReq.
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r--src/cowboy_http2.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index 18a367b..f5d80ce 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -497,7 +497,7 @@ headers_frame(State=#state{opts=Opts, streams=Streams}, StreamID, Req) ->
end.
early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer},
- StreamID, _IsFin, _Headers, #{method := Method},
+ StreamID, _IsFin, Headers, #{method := Method},
StatusCode0, HumanReadable) ->
%% We automatically terminate the stream but it is not an error
%% per se (at least not in the first implementation).
@@ -508,7 +508,8 @@ early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer},
PartialReq = #{
ref => Ref,
peer => Peer,
- method => Method
+ method => Method,
+ headers => headers_to_map(Headers, #{})
},
Resp = {response, StatusCode0, RespHeaders0=#{<<"content-length">> => <<"0">>}, <<>>},
try cowboy_stream:early_error(StreamID, Reason, PartialReq, Resp, Opts) of