Skip to content

Commit

Permalink
fix: Multipart boundaries are case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Sep 2, 2024
1 parent 8ab3217 commit f24c281
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,8 @@ def POST(self):
instances of :class:`FileUpload`.
"""
post = FormsDict()
content_type, options = _parse_http_header(self.content_type)[0]
content_type = self.environ.get('CONTENT_TYPE', '')
content_type, options = _parse_http_header(content_type)[0]
# We default to application/x-www-form-urlencoded for everything that
# is not multipart and take the fast path (also: 3.1 workaround)
if not content_type.startswith('multipart/'):
Expand Down
4 changes: 2 additions & 2 deletions test/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ def assertInError(self, search, route='/', **kargs):
self.fail('The search pattern "%s" is not included in wsgi.error: %s' % (search, err))

def multipart_environ(fields, files):
boundary = str(uuid.uuid1())
boundary = 'lowerUPPER-1234'
env = {'REQUEST_METHOD':'POST',
'CONTENT_TYPE': 'multipart/form-data; boundary='+boundary}
wsgiref.util.setup_testing_defaults(env)
boundary = '--' + boundary
boundary = '--' + boundary
body = ''
for name, value in fields:
body += boundary + '\r\n'
Expand Down

0 comments on commit f24c281

Please sign in to comment.