Skip to content

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

Merged
ioquatix merged 1 commit intorack:3-1-stablefrom
Earlopain:3-1-stable-cgi
May 17, 2025
Merged

[3-1-stable] Replace usage of CGI::Cookie#2328
ioquatix merged 1 commit intorack:3-1-stablefrom
Earlopain:3-1-stable-cgi

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
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