You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Arturo Bernal (Jira)" <ji...@apache.org> on 2024/06/20 06:07:00 UTC
[jira] [Resolved] (HTTPCLIENT-2331) Single cookie header should be sent for multiple cookies
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Arturo Bernal resolved HTTPCLIENT-2331.
---------------------------------------
Resolution: Fixed
Solved
https://github.com/apache/httpcomponents-client/pull/561
> Single cookie header should be sent for multiple cookies
> --------------------------------------------------------
>
> Key: HTTPCLIENT-2331
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2331
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (async), HttpClient (classic)
> Reporter: Nikhil Chaudhari
> Priority: Minor
> Fix For: 5.4-alpha3
>
> Attachments: DemoServiceOneController.java, DemoServiceOneLogs.txt, DemoServiceTwoController.java
>
>
> Single cookie header should be sent for multiple cookies
> *Use case* -
> When *Cookie* header is added explicitly using {*}setHeader{*}() method and there exists multiple cookies in cookie store (BasicCookieStore), then for this use case two Cookie headers are sent by HttpClient.
> *Expectation* - Single Cookie header should be sent by Apache HttpClient where all cookies should be separated by semi-colon
> *Actual* - Two Cookie headers are sent by Apache HttpClient, where in cookie set using setHeader is sent as one cookie Header and cookies in BasicCookieStore are sent in another Cookie header wherein value is all cookies separates by semi-colon.
>
> *Steps to reproduce -*
> # Setup two microservices
> # 1st microservice will set custom Cookie header as part of API request to 2nd micro service.
> # 2nd microservice will respond back with two Set-Cookie headers
> # First time when call is made from 1st micro service to 2nd micro service only custom cookie header will be sent and BasicCookieStore on 1st microservice will be updated with cookies that we got from 2nd microservice
> # Second time when call is made from 1st micro service to 2nd micro service both custom cookie and cookies from BasicCookieStore will be sent as separate Cookie headers.
>
> {code:java}
> 2024-06-18 09:45:28.074 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> GET /demo-service-two/test HTTP/1.1
> 2024-06-18 09:45:28.074 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> Cookie: MyCustomCookie=QWERTY
> 2024-06-18 09:45:28.074 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> Accept-Encoding: gzip, x-gzip, deflate
> 2024-06-18 09:45:28.075 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> Host: localhost:8091
> 2024-06-18 09:45:28.075 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> Connection: keep-alive
> 2024-06-18 09:45:28.075 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> User-Agent: Apache-HttpClient/5.1.3 (Java/17.0.8)
> 2024-06-18 09:45:28.075 DEBUG 3540 --- [nio-8090-exec-7] org.apache.hc.client5.http.headers : http-outgoing-1 >> Cookie: ServiceTwoSession1=POIUY; ServiceTwoSession2=ZXCVB {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