8000 [3-1-stable] Replace usage of `CGI::Cookie` by Earlopain · Pull Request #2328 · rack/rack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[3-1-stable] Replace usage of CGI::Cookie #2328

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

Merged
merged 1 commit into from
May 17, 2025

Conversation

Earlopain
Copy link
Contributor

It's #2327, but for the latest stable version (:

cc @byroot

@byroot
Copy link
Contributor
byroot commented May 12, 2025

Are you planing to do a 2.x backport or should I?

@Earlopain
Copy link
Contributor Author

@byroot I wasn't thinking about that, pelase do.

In Ruby 3.5, `cgi` will only contain functions related to escaping/unescaping.

https://bugs.ruby-lang.org/issues/21258

This is not an exact replicate of course, (`CGI::Cookie`) has some validations and coerces on setters but considering
for that purpose this is, they don't seem necessary?
During construction of the object rack already does conversions as necessary and setters don't make much sense, and aren't documented/tested for.

Although, for improved backwards compatibility, it wouldn't be much effort to make them `attr_accesor` instead.
@ioquatix ioquatix merged commit 3c1a46d into rack:3-1-stable May 17, 2025
16 checks passed
@@ -100,7 +128,7 @@ def parse_cookies_from_header
def identify_cookie_attributes(cookie_filling)
cookie_bits = cookie_filling.split(';')
cookie_attributes = Hash.new
cookie_attributes.store('value', cookie_bits[0].strip)
cookie_attributes.store('value', Array(cookie_bits[0].strip))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CGI::Cookie does this in its constructor (it's also a subclass of Array). It's required for the wrapper so value[0] doesn't just return a single char.

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.

4 participants
0