diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index ff2c8a8a..5254aec1 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -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 diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb index 05597f9e..7249960b 100644 --- a/lib/webrick/httputils.rb +++ b/lib/webrick/httputils.rb @@ -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