aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-22 15:04:37 +0200
committerLoïc Hoguin <[email protected]>2019-09-22 16:46:45 +0200
commit37b771210f94b9b692d0417d79483b9927d46ba2 (patch)
tree9081a202c1323028f15828a0520e53b6a2074d5e /src/gun_http.erl
parent0a5879ceffa3a96666ed8406c1557759811d8a16 (diff)
downloadgun-37b771210f94b9b692d0417d79483b9927d46ba2.tar.gz
gun-37b771210f94b9b692d0417d79483b9927d46ba2.tar.bz2
gun-37b771210f94b9b692d0417d79483b9927d46ba2.zip
Document Socks support
Also correct various Socks related types. This commit also adds a new gun:protocols/0 type as a simpler way of describing preferred protocols. The protocol/opts tuple is also documented. This commit also fixes an issue with the default value for the preferred protocols when using CONNECT over TLS. It was mistakenly not enabling http2 by default.
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r--src/gun_http.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index ce174ce..8860baa 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -301,7 +301,6 @@ handle_head(Data, State=#http_state{version=ClientVersion, content_handlers=Hand
_ = end_stream(State#http_state{streams=[Stream|Tail]}),
NewHost = maps:get(host, Destination),
NewPort = maps:get(port, Destination),
- Protocols = maps:get(protocols, Destination, [http]),
case Destination of
#{transport := tls} ->
HandshakeEvent = #{
@@ -310,10 +309,11 @@ handle_head(Data, State=#http_state{version=ClientVersion, content_handlers=Hand
tls_opts => maps:get(tls_opts, Destination, []),
timeout => maps:get(tls_handshake_timeout, Destination, infinity)
},
+ Protocols = maps:get(protocols, Destination, [http2, http]),
{[{origin, <<"https">>, NewHost, NewPort, connect},
{tls_handshake, HandshakeEvent, Protocols}], EvHandlerState1};
_ ->
- [Protocol] = Protocols,
+ [Protocol] = maps:get(protocols, Destination, [http]),
{[{origin, <<"http">>, NewHost, NewPort, connect},
{switch_protocol, Protocol}], EvHandlerState1}
end;