dockerclient
dockerclient copied to clipboard
Add a read timeout for http.Client
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
Timeoutfield in http.Client. (only available for golang >= 1.3 though).
Thanks!
I like this.
@hoonmin Any way this could be tested?
/cc @vieux @ehazlett @donhcd @samalba
:+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?