ruby / webrick

HTTP server toolkit
BSD 2-Clause "Simplified" License
286 stars 97 forks source link

parsing multipart/form-data #80

Closed yas99en closed 3 years ago

yas99en commented 3 years ago

Hello,

httprequest.rb is implemented as follows:

    def parse_query()
      begin
        ...
        elsif self['content-type'] =~ /^multipart\/form-data; boundary=(.+)/
          ...

But some http clients use "multipart/form-data;boundary=...". (there is no space between ; and boundary).

RFC2045 does not tell about the spaces. https://tools.ietf.org/html/rfc2045#section-5.1

I suggest the following code.

    def parse_query()
      begin
        ...
        elsif self['content-type'] =~ /^multipart\/form-data; *boundary=(.+)/
          ...
yas99en commented 3 years ago

I made the pull request #80. Please see it.