diff options
-rw-r--r-- | guide/connect.md | 14 | ||||
-rw-r--r-- | src/gun.erl | 4 | ||||
-rw-r--r-- | test/twitter_SUITE.erl | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/guide/connect.md b/guide/connect.md index 147edf3..5655d66 100644 --- a/guide/connect.md +++ b/guide/connect.md @@ -13,16 +13,18 @@ server. Because of this, the connection must be initiated before being able to send any request. The process that creates the connection is also known as the -owner of the connection. Only this process can perform operations -on the connection, and only this process will receive messages -from the connection. +owner of the connection, or the controlling process.. Only +this process can perform operations on the connection, and +only this process will receive messages from the connection. -To open a new connection, the `gun:open/3` function can be used. +To open a new connection, the `gun:open/{2,3}` function can be used. ``` erlang -{ok, Pid} = gun:open("twitter.com", 443, []). +{ok, Pid} = gun:open("twitter.com", 443). ``` +Gun will by default assume that SSL should be used. + The connection is managed by a separate process and is supervised by the Gun supervisor directly. @@ -41,7 +43,7 @@ nature of Gun, we only need to create a monitor once when the connection is established. ``` erlang -{ok, Pid} = gun:open("twitter.com", 443, []). +{ok, Pid} = gun:open("twitter.com", 443). MRef = monitor(process, Pid). ``` diff --git a/src/gun.erl b/src/gun.erl index 112ab07..001d332 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -15,6 +15,7 @@ -module(gun). %% Connection. +-export([open/2]). -export([open/3]). -export([close/1]). -export([shutdown/1]). @@ -69,6 +70,9 @@ %% Connection. +open(Host, Port) -> + open(Host, Port, []). + open(Host, Port, Opts) -> case open_opts(Opts) of ok -> diff --git a/test/twitter_SUITE.erl b/test/twitter_SUITE.erl index ba3f949..ad698a3 100644 --- a/test/twitter_SUITE.erl +++ b/test/twitter_SUITE.erl @@ -48,7 +48,7 @@ end_per_suite(_) -> ok. spdy(_) -> - {ok, Pid} = gun:open("twitter.com", 443, []), + {ok, Pid} = gun:open("twitter.com", 443), Ref = gun:get(Pid, "/"), receive {gun_response, Pid, Ref, Status, Headers} -> |