Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to io.netty.handler.codec.http.cookie.Cookie in order to support cookies with duplicate keys #1749

Merged
merged 4 commits into from
Feb 27, 2024

Conversation

jguerra
Copy link
Collaborator

@jguerra jguerra commented Feb 27, 2024

We've been using the deprecated io.netty.handler.codec.http.Cookie and CookieDecoder.decode. CookieDecoder is unable to handle duplicate key names, so I had to switch us to the newer decoder. I'm also bumping to 2.5.0 since I had to make breaking changes to interfaces

gradle.properties Outdated Show resolved Hide resolved
map.put(cookie.getName(), existing);
}
existing.add(cookie);
map.computeIfAbsent(cookie.name(), k -> new ArrayList<>(1)).add(cookie);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

has = true;
break;
}
Cookie cookie = ClientCookieDecoder.STRICT.decode(setCookieValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional to use STRICT here vs LAX in HttpRequestMessageImpl.java and further down in add/setCookie?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I maintained the strict/lax behavior. By default CookieDecoder.decode() uses strict, but for whatever reason ServerCookieEncoder.encode uses lax

Co-authored-by: Gavin Bunney <409207+gavinbunney@users.noreply.github.com>
@jguerra jguerra merged commit 956328a into master Feb 27, 2024
5 checks passed
@jguerra jguerra deleted the jg/multi_cookie branch February 29, 2024 20:38
argha-c pushed a commit that referenced this pull request Sep 10, 2024
…rt cookies with duplicate keys (#1749)

* Switch to newer netty cookie parser

* more deprecated usages

* bump minor version

* Update gradle.properties

Co-authored-by: Gavin Bunney <409207+gavinbunney@users.noreply.github.com>

---------

Co-authored-by: Gavin Bunney <409207+gavinbunney@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants