You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Christian F (JIRA)" <ji...@apache.org> on 2017/12/19 18:45:00 UTC

[jira] [Created] (HTTPCLIENT-1892) Request hangs forever although sockettimeout and connecttimeout are set

Christian F created HTTPCLIENT-1892:
---------------------------------------

             Summary: Request hangs forever although sockettimeout and connecttimeout are set
                 Key: HTTPCLIENT-1892
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1892
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (classic)
    Affects Versions: 4.5.3
         Environment: linux
            Reporter: Christian F


I try to perform a head request with the http client. The client uses a proxy. The requested domain is not existing. But the proxy does not close the connection.
But what I dont understand, is why the client hangs forever and non of the configured timeouts activates and aborts the request.
Her is my example code:
{{httpResponse = proxiedHttpClient.execute(
        new HttpHead("https://static.blogwalk.de/wp-content/uploads/sites/22/2017/08/22104117/166A9899-1.jpg"))}}

Here is my code for configuring the client:
{{final String hostName = "proxyhost";
final int port = 1234;
final HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.useSystemProperties();
    clientBuilder.setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(STANDARD).build());
clientBuilder.setProxy(new HttpHost(hostName, port));
clientBuilder.setDefaultCredentialsProvider(
getCredentialsProvider(hostName, port, "proxyuser", proxypassword));
clientBuilder.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy());
return clientBuilder.build();}}

Here is the request performed with curl:
{{curl -X HEAD --proxy "proxyuser:proxypassword@proxyhost:1234"  "https://iAmNotExisting.com/dummy.jpg" --verbose
* About to connect() to proxy proxyhost port (#0)
*   Trying 15.112.12.32...
* Connected to proxyhost (15.112.12.32) port 1234 (#0)
* Establish HTTP proxy tunnel to iAmNotExisting.com:443
* Proxy auth using Basic with user 'proxyuser'
> CONNECT iAmNotExisting.com:443 HTTP/1.1
> Host: iAmNotExisting.com:443
> Proxy-Authorization: Basic blablub=
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
> 
* Operation timed out after 300314 milliseconds with 0 out of 0 bytes received
* Closing connection 0
curl: (28) Operation timed out after 300314 milliseconds with 0 out of 0 bytes received}}

I think, this is either a bug, because the socket timeout does not work or that a request timeout would be needed if the socket timeout is not intended for this use case

The behavior of the proxy could be caused, because it is a keep-alive session.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org