[
https://issues.apache.org/jira/browse/HTTPCLIENT-2415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18057735#comment-18057735
]
ASF subversion and git services commented on HTTPCLIENT-2415:
-------------------------------------------------------------
Commit 9189d11abf60ecfae84f1d324629b4f47ead4e62 in httpcomponents-client's
branch refs/heads/master from Arturo Bernal
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=9189d11ab ]
HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching (#803)
Strip query / fragment from CookieOrigin path per RFC 6265.
Add regression tests for request-targets containing '?', '#'.
> Cookie not send if path attribute is the same as request path with query
> params
> -------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2415
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2415
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Affects Versions: 5.6
> Reporter: Christoph Lee
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> If a cookie has a path attribute other than '/' the cookie is not added to
> requests that have the same path but with a query parameter (e.g. /path?foo).
> *example*
> * Cookie with attribute path=/foo/bar
> * Request is /foo/bar?param=value
> * Cookie is not send
> h2. Analysis
> It seems that the BasicPathHandler assumes the CookieOrigin::getPath only
> returns the path (without query parameters) which is not the case.
> h2. Possible Solution
> I think there are two possible solutions
> 1.) Change BasicPathHandler to support paths containing query parameters
> So that this test doesn't fail anymore
> {code}
> @Test
> void testPathMatchWithQueryParams() {
> final BasicClientCookie cookie = new BasicClientCookie("name", "value");
> final CookieOrigin origin = new CookieOrigin("somehost", 80,
> "/stuff?foo", false);
> final CookieAttributeHandler h = BasicPathHandler.INSTANCE;
> cookie.setPath("/stuff");
> Assertions.assertTrue(h.match(cookie, origin));
> }
> {code}
> 2.) Remove query params from the CookieOrigins path.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]