[ https://issues.apache.org/jira/browse/HTTPCLIENT-2343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Arturo Bernal closed HTTPCLIENT-2343. ------------------------------------- Resolution: Won't Fix After thorough review and testing, it is clear that the current approach does not align with the intended optimization of eliminating map lookups for frequently used attributes. The recommended path forward is to use the latest versions of the library, which provide better performance and improved handling of context attributes > 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 > Reporter: Simon F > Priority: Minor > Fix For: 5.4.1 > > 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