dockerclient icon indicating copy to clipboard operation
dockerclient copied to clipboard

Add a read timeout for http.Client

Open hoonmin opened this issue 10 years ago • 2 comments

Hi. NewDockerClientTimeout() supports an option to set a timeout for HTTP request. But currently it seems to set just a connection timeout with DialTimeout. It could be good enough but I think we need a read timeout:

  • It's always possible to get slow responses.
  • When out-going packets are dropped in an established (keep-alive) connection, the connection timeout has no effect.

This PR includes:

  • Removed current DialTimeout().
  • Added Timeout field in http.Client. (only available for golang >= 1.3 though).

Thanks!

hoonmin avatar Mar 05 '15 16:03 hoonmin

I like this.

@hoonmin Any way this could be tested?

/cc @vieux @ehazlett @donhcd @samalba

aluzzardi avatar May 12 '15 20:05 aluzzardi

:+1: for testing. I made some hacky tests in a PR at https://github.com/hoonmin/dockerclient/pull/1/files and they don't pass... any idea why?

donhcd avatar May 12 '15 22:05 donhcd