You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2018-06-27.16:06:08.351>labels= ['type-bug', 'library']
title="cgi.FieldStorage doesn't parse QUERY_STRING with POST that is not application/x-www-form-urlencoded"updated_at=<Date2018-06-27.16:06:08.351>user='https://bugs.python.org/DanielKlein'
The documentation says "A form submitted via POST that also has a query string will contain both FieldStorage and MiniFieldStorage items." suggesting that I can have a query with bost a QUERY_STRING and POST parameters. The code backs this up most of the time...
In read_urlencoded() the initial query string is read from STDIN, and self.qs_on_post (i.e., env['QUERY_STRING']) is appended to that. This is what is called when the CONTENT_TYPE of the POST request is application/x-www-form-urlencoded. This leads to a FieldStorage object containing a list of MiniFieldStorage objects, like:
However, I am using a webhook interface from Google cloud, and it (legitimately!) does a POST with a CONTENT_TYPE of application/json.
When I call cgi.Fieldstorage(), the __init__ routine ultimately calls read_single(). This results in a FieldStorage object containing a single string as
FieldStorage(None, None, '{"incident": {"incident_id": "0.ktptjso969s0","res...the rest of the JSON')
This results in a few problems.
The QUERY_STRING args are not parsed as promised
The FeildStorage object does not contain a list, and so will raise TypeError, "not indexable" if I try to use most of the other FieldStorage methods.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: