diff options
author | Loïc Hoguin <[email protected]> | 2017-11-15 14:39:36 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-11-15 14:39:36 +0100 |
commit | cbbb4d5523f8738b237593f9516c3a237d0cc2f4 (patch) | |
tree | 7171b2a9a2750af1409fede12e61971d479d7148 /src/gun_http2.erl | |
parent | 2ea86ea1a47d47cae7d6c8f21d49bf2913681008 (diff) | |
download | gun-cbbb4d5523f8738b237593f9516c3a237d0cc2f4.tar.gz gun-cbbb4d5523f8738b237593f9516c3a237d0cc2f4.tar.bz2 gun-cbbb4d5523f8738b237593f9516c3a237d0cc2f4.zip |
Add preliminary support for trailers
The code is definitely not the best, but as long as it doesn't
break anything it should be OK for now.
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r-- | src/gun_http2.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl index decc206..cc57f65 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -160,9 +160,15 @@ frame({headers, StreamID, IsFin, head_fin, HeaderBlock}, remote_fin(Stream#stream{handler_state=Handlers}, State#http2_state{decode_state=DecodeState}, IsFin) end; + %% @todo For now we assume that it's a trailer if there's no :status. + %% A better state machine is needed to distinguish between that and errors. false -> - stream_reset(State, StreamID, {stream_error, protocol_error, - 'Malformed response; missing :status in HEADERS frame. (RFC7540 8.1.2.4)'}) + %% @todo We probably want to pass this to gun_content_handler? + ReplyTo ! {gun_trailers, self(), StreamRef, Headers0}, + remote_fin(Stream, State#http2_state{decode_state=DecodeState}, fin) +%% false -> +%% stream_reset(State, StreamID, {stream_error, protocol_error, +%% 'Malformed response; missing :status in HEADERS frame. (RFC7540 8.1.2.4)'}) end catch _:_ -> terminate(State, StreamID, {connection_error, compression_error, |