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

ASF subversion and git services commented on HTTPCLIENT-2331:
-------------------------------------------------------------

Commit 336263da6c7ac509ae2d40b9c36e043be52a11ba in httpcomponents-client's 
branch refs/heads/master from Arturo Bernal
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=336263da6 ]

Fix HTTPCLIENT-2331: Skip cookie header generation if a Cookie header is 
already present (#561)

This fix ensures that if a Cookie header is already present in the request, 
HttpClient skips adding additional Cookie headers from the BasicCookieStore.

> 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-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to