aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-11-15 14:39:36 +0100
committerLoïc Hoguin <[email protected]>2017-11-15 14:39:36 +0100
commitcbbb4d5523f8738b237593f9516c3a237d0cc2f4 (patch)
tree7171b2a9a2750af1409fede12e61971d479d7148 /src/gun.erl
parent2ea86ea1a47d47cae7d6c8f21d49bf2913681008 (diff)
downloadgun-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.erl')
-rw-r--r--src/gun.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 311e405..e6ed183 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -359,6 +359,8 @@ await(ServerPid, StreamRef, Timeout, MRef) ->
{response, IsFin, Status, Headers};
{gun_data, ServerPid, StreamRef, IsFin, Data} ->
{data, IsFin, Data};
+ {gun_trailers, ServerPid, StreamRef, Trailers} ->
+ {trailers, Trailers};
{gun_push, ServerPid, StreamRef, NewStreamRef, Method, URI, Headers} ->
{push, NewStreamRef, Method, URI, Headers};
{gun_error, ServerPid, StreamRef, Reason} ->
@@ -395,6 +397,10 @@ await_body(ServerPid, StreamRef, Timeout, MRef, Acc) ->
<< Acc/binary, Data/binary >>);
{gun_data, ServerPid, StreamRef, fin, Data} ->
{ok, << Acc/binary, Data/binary >>};
+ %% It's OK to return trailers here because the client
+ %% specifically requested them.
+ {gun_trailers, ServerPid, StreamRef, Trailers} ->
+ {ok, Acc, Trailers};
{gun_error, ServerPid, StreamRef, Reason} ->
{error, Reason};
{gun_error, ServerPid, Reason} ->