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
Backport 2104 3-0-stable #2164
Backport 2104 3-0-stable #2164
Conversation
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.
One minor change requested, then this should be good.
lib/rack/multipart/parser.rb
Outdated
@@ -213,6 +213,8 @@ def initialize(boundary, tempfile, bufsize, query_parser) | |||
|
|||
@sbuf = StringScanner.new("".dup) | |||
@body_regex = /(?:#{EOL}|\A)--#{Regexp.quote(boundary)}(?:#{EOL}|--)/m | |||
@body_regex_at_end = /#{@body_regex}\z/m |
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.
I don't think @body_regex_at_end
is used by this code, so it should not be added.
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.
Oops, it came with the cherry pick by accident. I removed it.
Return empty when parsing a multi-part POST with only one end delimiter. Fixed: rack#2103 Sending the following request in a browser generates a request with with only one end delimiter. ```javascript const formData = new FormData(); const request = new Request('http://127.0.0.1:8080/', { method: 'POST', body: formData, }); const response = fetch(request); ``` ``` curl 'http://127.0.0.1:8080/' \ -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryR1LC4tR6ayskIXJm' \ --data-raw $'------WebKitFormBoundaryR1LC4tR6ayskIXJm--\r\n' ``` This request is not compliant RFC7578, but is generated by major browsers such as FireFox and Chrome. Supporting this request will cause the multipart parser to return an empty value.
a160e08
to
47351c9
Compare
Thanks everyone! |
Bug fix #2104 backported to 3-0-stable (to cut a release).
Follow up from #2163