cmullaparthi / ibrowse

Erlang HTTP client
Other
515 stars 191 forks source link

connect socket options need to be filtered out when making subsequent calls #161

Open someotherrandomdude opened 6 years ago

someotherrandomdude commented 6 years ago

in ibrowse_http_client:send_req1 ok = do_setopts(Socket, Caller_socket_options, State), is called with the originally provided socket options, but these need the connect options filtering out as they are invalid when set on a connected socket, causing the call to ibrowse:send_req/X fail

the below works for me, called on the Caller_socket_options before doing the setopts, not sure if you want to also re-filter using the existing filter_socket_options, which also isn't called on the Caller_socket_options when the socket is open.

Tried to make a branch and push but looks like I don't have permissions.

%%Once a socket is connected, passing certain options is no longer valid filter_sock_connect_options(Opts) -> lists:filter( fun({port, _Port}) -> false; ({ip, _SocketAddr}) -> false; ({fd, _Fd}) -> false; ({ifaddr, _SocketAddr}) -> false; ({tcp_module, Module}) -> false; (inet) -> false; (inet6) -> false; (local) -> false; () -> true end, Opts).