[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data

2020-09-03 Thread Robert


Robert  added the comment:

Would this patch already solve? :

https://github.com/python/cpython/pull/19130

There seems to be another bug: The strange 'latin-1' default encoding of 
cgi.parse(), which only has effect in non-mulitpart:

if hasattr(fp,'encoding'):
encoding = fp.encoding
else:
encoding = 'latin-1'


( cgi.FieldStorage and the other functions in cgi and urllib.parse use a 
'utf-8' default correctly - and do not try fp.encoding, which is usually not 
present and not reasonable in form handling WSGI. And 
'application/x-www-form-urlencoded' implies  utf-8. )

=> that default should possibly become utf-8. Optionally cgi.parse() could take 
an extra parameter encoding=None  .

--
nosy: +kxroberto2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data

2020-07-20 Thread Rhodri James


Change by Rhodri James :


--
nosy:  -Rhodri James

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data

2020-02-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +Rhodri James, ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data

2020-02-22 Thread James Edington

James Edington  added the comment:

Here is a file to try it out in an instant.

(lines 11–28 are not necessary; they are just "luxuries" allowing easier 
testing of the issue in a web browser)

--
Added file: https://bugs.python.org/file48903/demo.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39727] cgi.parse() fatally attempts str.decode when handling multipart/form-data

2020-02-22 Thread James Edington


New submission from James Edington :

It appears that cgi.parse() in Python 3.7.6 [GCC 9.2.1 20190827 (Red Hat 
9.2.1-1)] fatally chokes on POST requests with multipart/form-data due to some 
internal processing still relying on assumptions from when str and bytes were 
the same object.

I'll attach as the first comment the "try-it-at-home" file to demonstrate this 
error.

--
components: Library (Lib)
files: curlLogs.txt
messages: 362490
nosy: James Edington
priority: normal
severity: normal
status: open
title: cgi.parse() fatally attempts str.decode when handling multipart/form-data
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48902/curlLogs.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com