From 8366ba94bb9e450221a246acdd482c0162affcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 8 Apr 2015 23:34:08 +0300 Subject: Use maps for and improve options The type option has been removed. The transport and protocols options can be used in its place. The transport_opts option can be used to specify transport options. The http_opts and spdy_opts options can be used to specify protocol specific options. The keepalive option is now a protocol specific option. Defaults depending on the port number have changed. Now only port 443 uses ssl by default, other ports use tcp. --- doc/src/guide/connect.asciidoc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'doc/src/guide') diff --git a/doc/src/guide/connect.asciidoc b/doc/src/guide/connect.asciidoc index e1ad56e..e2bcaa7 100644 --- a/doc/src/guide/connect.asciidoc +++ b/doc/src/guide/connect.asciidoc @@ -33,16 +33,24 @@ The `gun:open/{2,3}` function must be used to open a connection. [source,erlang] {ok, ConnPid} = gun:open("example.org", 443). -@todo open/3 -@todo make opts a map +If the port given is 443, Gun will attempt to connect using +SSL. The protocol will be selected automatically using the +NPN extension for TLS. By default Gun supports SPDY/3.1, +SPDY/3 and HTTP/1.1 when connecting using SSL. -If the port given is 80, Gun will attempt to connect using -TCP and use the HTTP/1.1 protocol. For any other port, TLS -will be used. The NPN extension for TLS allows Gun to select -SPDY automatically if the server supports it. Otherwise, -HTTP/1.1 will be used. +For any other port, Gun will attempt to connect using TCP +and will use the HTTP/1.1 protocol. -@todo more about defaults +The transport and protocol used can be overriden using +options. The manual documents all available options. + +Options can be provided as a third argument, and take the +form of a map. + +.Opening an SSL connection to example.org on port 8443 + +[source,erlang] +{ok, ConnPid} = gun:open("example.org", 8443, #{transport=>ssl}). === Monitoring the connection process -- cgit v1.2.3