You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Patrick Barry (Jira)" <ji...@apache.org> on 2023/03/29 18:11:00 UTC

[jira] [Created] (HTTPCLIENT-2267) Connect called before Interceptors are invoked

Patrick Barry created HTTPCLIENT-2267:
-----------------------------------------

             Summary: Connect called before Interceptors are invoked
                 Key: HTTPCLIENT-2267
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2267
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
    Affects Versions: 5.2.1
            Reporter: Patrick Barry


We tried to migrated to 5.2.1 from 5.1.4.  Right away, our unit tests showed us that our HttpRequestInterceptor that was registered "addRequestInterceptorFirst" is not called before a connection is attempted to be established.  Expected behaviour is that our interceptor validation would catch malformed urls, etc  and kick out a known error to us.  Now, NoRouteToHostException is being thrown before our interceptor logic is hit.  The 'bad url' we were using in our test is:

[https://google.com:555|https://google.com:555/]

 

To recreate, standup new HttpAsyncClient, register an interceptor in first position and force it to use HTTP 1.1, and then generate a GET request to [https://google.com:555|https://google.com:555/]

 
{code:java}
java.net.NoRouteToHostException: No route to host
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:579)
    at java.base/sun.nio.ch.Net.connect(Net.java:586)
    at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:853)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.lambda$processConnectionRequest$0(SingleCoreIOReactor.java:336)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.processConnectionRequest(SingleCoreIOReactor.java:335)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.processPendingConnectionRequests(SingleCoreIOReactor.java:307)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:138)
    at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
    at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
    at java.base/java.lang.Thread.run(Thread.java:833) {code}
 

 

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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