-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Only load what is required from cgi
for Ruby 3.5
#3247
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
base: version-3
Are you sure you want to change the base?
Conversation
This method will be removed in Ruby 3.5
In Ruby 3.5, most of the cgi gem is removed. Only methods relating to escaping/unescaping are retained. On versions before Ruby 3.5, `cgi/util` must be required for correct functionality. https://bugs.ruby-lang.org/issues/21258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need cgi as a dependency as well? Is it being removed as a bundled gem entirely, or are you saying that parts are being removed but cgi is still bundled?
@@ -159,7 +159,7 @@ module S3 | |||
allow(Time).to receive(:now).and_return(now) | |||
url, headers = obj.presigned_request( | |||
:get, expires_in: 86_400, request_payer: 'peccy') | |||
expect(CGI.parse(url)).to eq(CGI.parse( | |||
expect(URI.decode_www_form(url)).to eq(URI.decode_www_form( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these actually equivalent? Is there any supporting documentation for these implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CGI.parse
: https://docs.ruby-lang.org/en/3.4/CGI.html#method-c-parse
URI.decode_www_form
: https://docs.ruby-lang.org/en/3.4/URI.html#method-c-decode_www_form
It treats it as x-www-form-urlencoded
, which uses the query string format of key=value&key2=value
.
They return data in a slightly different format. CGI.parse
returns a hash, URI.decode_www_form
an array of 2-element arrays. For tests to just check against this is fine, if it were exposed to users it would need a different solution.
@Earlopain I've performed a review. Do you know for sure this change is being made? It seems a bit premature since Ruby 3.5 is not released and the cgi work is not complete. |
Thanks for taking a look.
Things like
Ruby already did the work to handle this change in their own code ( |
Thanks. I think it would be prudent to wait until Ruby 3.5 preview confirms the changes. I've prepared this release with changelogs. |
In Ruby 3.5, most of the
cgi
gem is removed. Only methods relating to escaping/unescaping are retained.On versions before Ruby 3.5,
cgi/util
must be required for correct functionality.https://bugs.ruby-lang.org/issues/21258
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the
CHANGELOG.md
file (at corresponding gem). For the description entry, please make sure it lives in one line and starts withFeature
orIssue
in the correct format.For generated code changes, please checkout below instructions first:
https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
Thank you for your contribution!