ninenines / gun

HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
ISC License
898 stars 231 forks source link

Allow IP tuple for host #152 #153

Closed seudin closed 6 years ago

essen commented 6 years ago

I don't think this is working:

2> application:ensure_all_started(gun).     
{ok,[crypto,asn1,public_key,ssl,cowlib,ranch,gun]}
3> {ok, C} = gun:open({64,233,184,138}, 80).
{ok,<0.91.0>}
4> gun:get(C, "/").
#Ref<0.1855665614.3723493377.109334>
5> 
=ERROR REPORT==== 7-May-2018::13:44:18 ===
Bad value on output port 'tcp_inet'

It's probably trying to send a tuple for the Host header.

seudin commented 6 years ago

It will working with header <<"host">>.

gun:get(C, "/", [{<<"host">>, ["64.233.184.138"]}]).

I will update PR for no host header.

seudin commented 6 years ago

The PR is updated.

essen commented 6 years ago

Merged locally, pushed in a few. Thanks!