diff options
author | Loïc Hoguin <[email protected]> | 2018-06-04 08:40:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-06-04 08:40:31 +0200 |
commit | 93c88fdc541c3f8a4ebbae3699bee90d00dc637f (patch) | |
tree | 236d186d109db248821674ead9e3148617d3e5d1 /src/gun_http2.erl | |
parent | 1be0151ec7b6a98064e648d5598f56cbdec65dc7 (diff) | |
download | gun-93c88fdc541c3f8a4ebbae3699bee90d00dc637f.tar.gz gun-93c88fdc541c3f8a4ebbae3699bee90d00dc637f.tar.bz2 gun-93c88fdc541c3f8a4ebbae3699bee90d00dc637f.zip |
Remove the dependency on Ranch
We instead of two new modules, gun_tcp and gun_tls.
They only have 6 functions so far, much less than
what Ranch provided before.
Also renames ssl to tls where applicable. It's still
possible to use the ssl transport option but it's now
undocumented.
Diffstat (limited to 'src/gun_http2.erl')
-rw-r--r-- | src/gun_http2.erl | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl index 1f25e83..cf83970 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -370,9 +370,9 @@ prepare_headers(EncodeState, Transport, Method, Host0, Port, Path, Headers0) -> lists:keydelete(<<"upgrade">>, 1, Headers0)))))), Headers = [ {<<":method">>, Method}, - {<<":scheme">>, case Transport:secure() of - true -> <<"https">>; - false -> <<"http">> + {<<":scheme">>, case Transport of + gun_tls -> <<"https">>; + gun_tcp -> <<"http">> end}, {<<":authority">>, Authority}, {<<":path">>, Path} @@ -465,17 +465,17 @@ send_data(State=#http2_state{socket=Socket, transport=Transport, opts=Opts, min(RemoteMaxFrameSize, ConfiguredMaxFrameSize) ), case Data of - {sendfile, Offset, Bytes, Path} when Bytes =< MaxSendSize -> - Transport:send(Socket, cow_http2:data_header(StreamID, IsFin, Bytes)), - Transport:sendfile(Socket, Path, Offset, Bytes), - {State#http2_state{local_window=ConnWindow - Bytes}, - Stream#stream{local=IsFin, local_window=StreamWindow - Bytes}}; - {sendfile, Offset, Bytes, Path} -> - Transport:send(Socket, cow_http2:data_header(StreamID, nofin, MaxSendSize)), - Transport:sendfile(Socket, Path, Offset, MaxSendSize), - send_data(State#http2_state{local_window=ConnWindow - MaxSendSize}, - Stream#stream{local_window=StreamWindow - MaxSendSize}, - IsFin, {sendfile, Offset + MaxSendSize, Bytes - MaxSendSize, Path}, In); +% {sendfile, Offset, Bytes, Path} when Bytes =< MaxSendSize -> +% Transport:send(Socket, cow_http2:data_header(StreamID, IsFin, Bytes)), +% Transport:sendfile(Socket, Path, Offset, Bytes), +% {State#http2_state{local_window=ConnWindow - Bytes}, +% Stream#stream{local=IsFin, local_window=StreamWindow - Bytes}}; +% {sendfile, Offset, Bytes, Path} -> +% Transport:send(Socket, cow_http2:data_header(StreamID, nofin, MaxSendSize)), +% Transport:sendfile(Socket, Path, Offset, MaxSendSize), +% send_data(State#http2_state{local_window=ConnWindow - MaxSendSize}, +% Stream#stream{local_window=StreamWindow - MaxSendSize}, +% IsFin, {sendfile, Offset + MaxSendSize, Bytes - MaxSendSize, Path}, In); Iolist0 -> IolistSize = iolist_size(Iolist0), if @@ -500,7 +500,7 @@ send_trailers(State=#http2_state{socket=Socket, transport=Transport, encode_stat queue_data(Stream=#stream{local_buffer=Q0, local_buffer_size=Size0}, IsFin, Data, In) -> DataSize = case Data of - {sendfile, _, Bytes, _} -> Bytes; +% {sendfile, _, Bytes, _} -> Bytes; Iolist -> iolist_size(Iolist) end, Q = queue:In({IsFin, DataSize, Data}, Q0), |