DicksonWu654 opened a new pull request, #947: URL: https://github.com/apache/httpcomponents-client/pull/947
`BasicPathHandler.pathMatch` trims a trailing slash from the cookie Path before comparing, so a cookie set with `Set-Cookie: a=b; Path=/foo/` is sent to `/foo`. RFC 6265 section 5.1.4 only lets the cookie path match when the two paths are identical, or when the cookie path is a prefix of the request path and either ends in "/" or is followed by "/" there. `/foo/` isn't a prefix of `/foo`, so it shouldn't match. This change keeps the cookie path as is. `Path=/foo/` now matches `/foo/` and `/foo/bar` but not `/foo`. `Path=/foo` still matches `/foo`, `/foo/` and `/foo/bar` and not `/foobar`, and `Path=/` still matches everything. Cookies without a Path aren't affected, since the default path never ends in a slash (`/dir/page` gives `/dir`). This is the first of the three cookie items from the [email protected] thread. `testBasicPathMatch6` asserted the old trimming (`/stuff/` matching `/stuff`), so I flipped it, and a new test in `TestRFC6265CookieSpec` covers the cases above through `RFC6265StrictSpec`. `./mvnw -pl httpclient5 -am verify` on master (28844736) passes: 1161 tests, with Checkstyle, RAT and japicmp passing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
