aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_spdy.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-03-21 10:55:42 +0100
committerLoïc Hoguin <[email protected]>2014-03-21 10:56:34 +0100
commita1a254c4d001feb1b05c1f1620766de94c560823 (patch)
tree95427192a77433f7da3e7a208dffe8560080b7be /src/gun_spdy.erl
parent0c63c747f06b730ec8b80f9cc16717f160adc6a2 (diff)
downloadgun-a1a254c4d001feb1b05c1f1620766de94c560823.tar.gz
gun-a1a254c4d001feb1b05c1f1620766de94c560823.tar.bz2
gun-a1a254c4d001feb1b05c1f1620766de94c560823.zip
Improve the HTTP/1.1 and HTTP/1.0 support
Diffstat (limited to 'src/gun_spdy.erl')
-rw-r--r--src/gun_spdy.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gun_spdy.erl b/src/gun_spdy.erl
index d8070d1..f787831 100644
--- a/src/gun_spdy.erl
+++ b/src/gun_spdy.erl
@@ -14,7 +14,7 @@
-module(gun_spdy).
--export([init/3]).
+-export([init/4]).
-export([handle/2]).
-export([close/1]).
-export([keepalive/1]).
@@ -43,7 +43,7 @@
ping_id = 1 :: non_neg_integer()
}).
-init(Owner, Socket, Transport) ->
+init(Owner, Socket, Transport, []) ->
#spdy_state{owner=Owner, socket=Socket, transport=Transport,
zdef=cow_spdy:deflate_init(), zinf=cow_spdy:inflate_init()}.
@@ -183,6 +183,7 @@ keepalive(State=#spdy_state{socket=Socket, transport=Transport,
Transport:send(Socket, cow_spdy:ping(PingID)),
State#spdy_state{ping_id=PingID + 2}.
+%% @todo Allow overriding the host when doing requests.
request(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef,
stream_id=StreamID}, StreamRef, Method, Host, Path, Headers) ->
Out = false =/= lists:keyfind(<<"content-type">>, 1, Headers),
@@ -192,7 +193,7 @@ request(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef,
new_stream(StreamID, StreamRef, true, Out, <<"HTTP/1.1">>,
State#spdy_state{stream_id=StreamID + 2}).
-%% @todo Handle Body > 16MB.
+%% @todo Handle Body > 16MB. (split it out into many frames)
request(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef,
stream_id=StreamID}, StreamRef, Method, Host, Path, Headers, Body) ->
Transport:send(Socket, [
@@ -242,6 +243,7 @@ error_stream_not_found(State=#spdy_state{owner=Owner}) ->
State.
%% Streams.
+%% @todo probably change order of args and have state first?
new_stream(StreamID, StreamRef, In, Out, Version,
State=#spdy_state{streams=Streams}) ->