ostinelli / net-http2

NetHttp2 is an HTTP/2 client for Ruby.
MIT License
141 stars 31 forks source link

add timeout setting for "connect" #5

Closed stillwaiting closed 8 years ago

stillwaiting commented 8 years ago

There could be a situation when a server doesn't respond on connection (like here), so it fails. But the default timeout is huge: on my side it is ~90 seconds. Would it be possible to introduce it as an option (something like here).

Thanks.

ostinelli commented 8 years ago

If we implement such an option, we need to do so also for the non-SSL connections. Your example points to a SSL one, but this requires using Socket instead of TCPSocket too.

ostinelli commented 8 years ago

I've added a new client option connect_timeout that should do what you ask.

Can you please try out master and see if this works for you?

stillwaiting commented 8 years ago

Thanks a lot! Looks like it does the trick, but, unfortunately, apnotic is not passing the option as it is supposed to: here :connection_timeout key is passed while net-http2 expects :connect_timeout

ostinelli commented 8 years ago

Indeed. Will merge in. Closing here :)