Repository navigation
WebTestClientRequestConverter mishandles Cookie headers with multiple cookies or a cookie without = - #1076
Open
chuuminggg wants to merge 1 commit into
Open
WebTestClientRequestConverter mishandles Cookie headers with multiple cookies or a cookie without =#1076chuuminggg wants to merge 1 commit into
chuuminggg wants to merge 1 commit into
Conversation
Member
|
Thanks, @chuuminggg. 3.0.x is no longer supported. Can you please update your PR to use 4.0.x as its base branch? |
chuuminggg
force-pushed
the
n3-cookie-header-parsing
branch
from
October 15, 2026 23:22
b04e4f8 to
1d527bd
Compare
Previously, WebTestClientRequestConverter converted a Cookie header containing multiple cookies into a single cookie and failed with a StringIndexOutOfBoundsException when a cookie had no =. Each header value is now split on '; ' and a cookie without = is converted to a cookie with an empty value. Signed-off-by: chuuminggg <rorrxr@naver.com>
chuuminggg
force-pushed
the
n3-cookie-header-parsing
branch
from
October 16, 2026 00:46
1d527bd to
4c10317
Compare
Contributor
Author
|
I've rebased the PR onto 4.0.x and changed its base branch. The tests have also been updated to use JUnit 5 to match the 4.0.x conventions. |
chuuminggg
force-pushed
the
n3-cookie-header-parsing
branch
from
October 16, 2026 10:36
2c6873f to
4c10317
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #1038 / #1040.
WebTestClientRequestConverterstill mishandles two kinds ofCookieheader:A header that contains multiple cookies, as user agents send them (RFC 6265 §5.4), is converted to a single cookie:
produces one cookie named
cookieName1with the valuecookieVal1; cookieName2=cookieVal2. Using.cookie(name, value)twice works, as each cookie is in a separate header value.A cookie without
=fails the conversion:WebTestClientRequestConverter mishandles cookies whose value contains = and crashes on cookie headers without = #1038 described this case, and WebTestClientRequestConverter mishandles cookies whose value contains = #1040 mentioned handling it by returning an empty value, but the fix that was merged only changed the exception from an
ArrayIndexOutOfBoundsExceptionto aStringIndexOutOfBoundsException.This PR splits each
Cookieheader value on"; ", in the same way asRestTestClientRequestConverterinmain. A cookie without=is converted to a cookie with that name and an empty value. I'm happy to change this to skip the cookie or to throw a clearer exception if you prefer.The
mainbranch'sRestTestClientRequestConverteralready splits on"; ", but it has the samecreateRequestCookiemethod, so a cookie without=fails there as well. It isn't in4.0.x, so this PR doesn't change it. It may need the same change when merging forward.