diff options
-rw-r--r-- | src/gun.erl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl index e4a919d..8f056aa 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -378,7 +378,8 @@ init(Parent, Owner, Host, Port, Opts) -> Keepalive = get_value(keepalive, Opts, 5000), Retry = get_value(retry, Opts, 5), RetryTimeout = get_value(retry_timeout, Opts, 5000), - Type = get_value(type, Opts, ssl), + %% Default to TCP if port 80 is given, otherwise SSL. + Type = get_value(type, Opts, if Port =:= 80 -> tcp; true -> ssl end), connect(#state{parent=Parent, owner=Owner, host=Host, port=Port, keepalive=Keepalive, type=Type, retry=Retry, proto_opts=HTTPOpts, retry_timeout=RetryTimeout}, Retry). |