Improved timeout implementation for HTTP client.