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

Arturo Bernal commented on HTTPCLIENT-2343:
-------------------------------------------

HI [~bratkartoffel] 

What prevents you from switching to the new method ({{{}setUserToken(){}}})? 
Are there specific limitations or constraints that you’re facing in migrating 
to this approach?

> Regression in setting USER_TOKEN context attribute in 
> PoolingHttpClientConnectionManager
> ----------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2343
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2343
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.4-beta1
>            Reporter: Simon F
>            Priority: Major
>         Attachments: Reproducer.java
>
>
> Setting the USER_TOKEN context attribute changed between the 5.3.1 and 5.4 
> release.
> I’ve got a testcase where my application calls an https-endpoint five times 
> and checks that the source port used by the clients stays the same (the 
> existing connection is reused).
> Using the httpclient v5.3.1 everything works fine, all requests use the same 
> source port, but after upgrading to v5.4 my testcase fails.
> I’ve tracked down the issue to the USER_TOKEN, which we set explicitly on the 
> Context to reuse ssl connections even when client certificates are used.
> Due to performance reasons this is essential to us.
> We’ve set the Context like this:
> {code:java}
> HttpContext ctx = new HttpClientContext();
> ctx.setAttribute(HttpClientContext.{_}USER_TOKEN{_}, "localhost:8443");
> {code}
> But as seen in the logs, the USER_TOKEN is no longer added to the state:
> {code}
> [ForkJoinPool-1-worker-1] DEBUG 
> o.a.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - 
> ex-0000000001 endpoint lease request (3 MINUTES) [route: 
> \{s}->[https://localhost:65181]][total available: 0; route allocated: 0 of 
> 10; total allocated: 0 of 50]
> {code}
> After changing the way we set the USER_TOKEN, it works again:
> {code:java}
> HttpClientContext ctx = new HttpClientContext();
> ctx.setUserToken(location);
> {code}
> {code}
> [ForkJoinPool-1-worker-1] DEBUG 
> o.a.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - 
> ex-0000000001 endpoint lease request (3 MINUTES) [route: 
> \{s}->[https://localhost:65384]][state: ServiceLocation(hostname=localhost, 
> port=65384, ssl=true)][total available: 0; route allocated: 0 of 10; total 
> allocated: 0 of 50]
> {code}
> The USER_TOKEN was marked as deprecated in v5.4, but it should still work 
> without modification.



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

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

Reply via email to