[ 
https://issues.apache.org/jira/browse/HTTPASYNC-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16639565#comment-16639565
 ] 

Arkaitz Jimenez commented on HTTPASYNC-144:
-------------------------------------------

Hi Oleg,

As far as I can see, it only affects client authentication situations because 
for client authentication the connection pools will only give a connection to a 
request if they have the same user-token.

The MainClientExec link that you provided uses the handler to extract the 
user-token and stores the user-token in the *connection* context.

However, the _AbstractClientExchangeHandler_ does not use the Handler, 
therefore, it reads an empty user-token for the *request* context.

When the pools compare the tokens from *request context* and from *connection 
context* they do not match and the connection is not reused. They don't match 
because one was extracted with the handler in _MainClientExec_ and the other 
without the handler in _AbstractClientExchangeHandler_.

I am unsure if the blocking client works ok or not since I only use the async 
one.

When we don't use the UserTokenHandler and we set the User-Token directly in 
the request it all works as expected. 

Thanks

Arkaitz

 

> AbstractClientExchangeHandler does not make use of UserTokenHandler
> -------------------------------------------------------------------
>
>                 Key: HTTPASYNC-144
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-144
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>            Reporter: Arkaitz Jimenez
>            Priority: Major
>
> While writing an async client that does make use of SSL, user token handling 
> is essential for proper use of pooling.
> I found 2 ways of passing the user token to the client:
>  # Create a HttpClientContext and ctx.setUserToken(fixedString); and pass 
> that context to execute(request, ctx);
>  # Create the AsyncHttpClient via HttpAsyncClients.custom() and setting 
> setUserTokenHandler((ctx)->fixedString);
> The first one works no problem.
> The second one fails because AbstractClientExchangeHandler queries the 
> context userToken directly without using the UserTokenHandler in 
> AbstractClientExchangeHandler::requestConnection.
> That means the userToken for the request will always be null and never match 
> the one that is assigned to an open connection.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to