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

Fix for multipart #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/webrick/httprequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def parse_query()
@query = HTTPUtils::parse_query(@query_string)
elsif self['content-type'] =~ /^application\/x-www-form-urlencoded/
@query = HTTPUtils::parse_query(body)
elsif self['content-type'] =~ /^multipart\/form-data; boundary=(.+)/
elsif self['content-type'] =~ /^multipart\/form-data; *boundary=(.+)/
boundary = HTTPUtils::dequote($1)
@query = HTTPUtils::parse_form_data(body, boundary)
else
Expand Down
2 changes: 1 addition & 1 deletion lib/webrick/httputils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def parse_query(str)
# Parses form data in +io+ with the given +boundary+

def parse_form_data(io, boundary)
boundary_regexp = /\A--#{Regexp.quote(boundary)}(--)?#{CRLF}\z/
boundary_regexp = /\A--#{Regexp.quote(boundary)}(--|#{CRLF}|--#{CRLF})\z/
form_data = Hash.new
return form_data unless io
data = nil
Expand Down