diff options
author | Loïc Hoguin <[email protected]> | 2014-03-25 13:00:47 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-03-25 13:00:47 +0100 |
commit | ecc4f153cd713562c4d7b54ece0e274a411fd26f (patch) | |
tree | aef6a1e0069bc4e126b8a5f47e08f2f39eff15c9 | |
parent | 05b7adff1a2560a9c16d1ba94d0445e04db4bd80 (diff) | |
download | gun-ecc4f153cd713562c4d7b54ece0e274a411fd26f.tar.gz gun-ecc4f153cd713562c4d7b54ece0e274a411fd26f.tar.bz2 gun-ecc4f153cd713562c4d7b54ece0e274a411fd26f.zip |
Automatically calculate the content-length when possible in SPDY
-rw-r--r-- | src/gun_spdy.erl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gun_spdy.erl b/src/gun_spdy.erl index 0947c0f..5ada67a 100644 --- a/src/gun_spdy.erl +++ b/src/gun_spdy.erl @@ -202,10 +202,12 @@ request(State=#spdy_state{socket=Socket, transport=Transport, zdef=Zdef, %% @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) -> + Headers2 = lists:keystore(<<"content-length">>, 1, Headers, + {<<"content-length">>, integer_to_list(iolist_size(Body))}), Transport:send(Socket, [ cow_spdy:syn_stream(Zdef, StreamID, 0, false, false, 0, - Method, <<"https">>, Host, Path, <<"HTTP/1.1">>, Headers), + Method, <<"https">>, Host, Path, <<"HTTP/1.1">>, Headers2), cow_spdy:data(StreamID, true, Body) ]), new_stream(StreamID, StreamRef, true, false, <<"HTTP/1.1">>, |