diff options
author | Loïc Hoguin <[email protected]> | 2013-08-26 18:22:23 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-08-26 18:22:23 +0200 |
commit | 0c5a2c3a9097207da803da7ee45cdad2d387a5a4 (patch) | |
tree | 026c465aab70ad370c27a1fbdb8909bbc44d4b62 | |
parent | 2b2dfdea1f9859b575990f640e9f29864ab5161e (diff) | |
download | gun-0c5a2c3a9097207da803da7ee45cdad2d387a5a4.tar.gz gun-0c5a2c3a9097207da803da7ee45cdad2d387a5a4.tar.bz2 gun-0c5a2c3a9097207da803da7ee45cdad2d387a5a4.zip |
Remove the response functions
SPDY unfortunately is still completely client-server
and we can't do that according to the specs.
-rw-r--r-- | src/gun.erl | 21 | ||||
-rw-r--r-- | src/gun_spdy.erl | 36 |
2 files changed, 0 insertions, 57 deletions
diff --git a/src/gun.erl b/src/gun.erl index 011eed1..21666ec 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -37,10 +37,6 @@ -export([request/4]). -export([request/5]). -%% Responses. --export([response/4]). --export([response/5]). - %% Streaming data. -export([data/4]). @@ -148,15 +144,6 @@ request(ServerPid, Method, Path, Headers, Body) -> _ = ServerPid ! {request, self(), StreamRef, Method, Path, Headers, Body}, StreamRef. -%% Responses. - -response(ServerPid, StreamRef, Status, Headers) -> - _ = ServerPid ! {response, self(), StreamRef, Status, Headers}, - ok. -response(ServerPid, StreamRef, Status, Headers, Body) -> - _ = ServerPid ! {response, self(), StreamRef, Status, Headers, Body}, - ok. - %% Streaming data. data(ServerPid, StreamRef, IsFin, Data) -> @@ -295,14 +282,6 @@ loop(State=#state{parent=Parent, owner=Owner, host=Host, ProtoState2 = Protocol:request(ProtoState, StreamRef, Method, Host, Path, Headers, Body), loop(State#state{protocol_state=ProtoState2}); - {response, Owner, StreamRef, Status, Headers} -> - ProtoState2 = Protocol:response(ProtoState, - StreamRef, Status, Headers), - loop(State#state{protocol_state=ProtoState2}); - {response, Owner, StreamRef, Status, Headers, Body} -> - ProtoState2 = Protocol:response(ProtoState, - StreamRef, Status, Headers, Body), - loop(State#state{protocol_state=ProtoState2}); {data, Owner, StreamRef, IsFin, Data} -> ProtoState2 = Protocol:data(ProtoState, StreamRef, IsFin, Data), diff --git a/src/gun_spdy.erl b/src/gun_spdy.erl index 6b0dd94..410ed57 100644 --- a/src/gun_spdy.erl +++ b/src/gun_spdy.erl @@ -19,8 +19,6 @@ -export([keepalive/1]). -export([request/6]). -export([request/7]). --export([response/4]). --export([response/5]). -export([data/4]). -export([cancel/2]). @@ -183,40 +181,6 @@ request(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef, new_stream(StreamID, StreamRef, true, false, <<"HTTP/1.1">>, State#spdy_state{stream_id=StreamID + 2}). -response(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef}, - StreamRef, Status, Headers) -> - case get_stream_by_ref(StreamRef, State) of - #stream{out=false} -> - error_stream_closed(State); - S = #stream{id=StreamID, version=Version} -> - Out = false =/= lists:keyfind(<<"content-type">>, 1, Headers), - Transport:send(Socket, cow_spdy:syn_reply(Zdef, - StreamID, not Out, Status, Version, Headers)), - if Out -> - State; - true -> - out_fin_stream(S, State) - end; - false -> - error_stream_not_found(State) - end. - -response(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef}, - StreamRef, Status, Headers, Body) -> - case get_stream_by_ref(StreamRef, State) of - #stream{out=false} -> - error_stream_closed(State); - S = #stream{id=StreamID, version=Version} -> - Transport:send(Socket, [ - cow_spdy:syn_reply(Zdef, - StreamID, false, Status, Version, Headers), - cow_spdy:data(S#stream.id, true, Body) - ]), - out_fin_stream(S, State); - false -> - error_stream_not_found(State) - end. - data(State=#spdy_state{socket=Socket, transport=Transport}, StreamRef, IsFin, Data) -> case get_stream_by_ref(StreamRef, State) of |