diff options
author | Guido van Rossum <guido@python.org> | 1998-06-11 14:06:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-11 14:06:59 (GMT) |
commit | cff311aa373c11756bbd353bfe77819f5d777598 (patch) | |
tree | dffd77368beab660bfa217665a9cb882722e3d43 /Lib/cgi.py | |
parent | e894fc0ea324b90e25ccd680aa4c908be6711555 (diff) | |
download | cpython-cff311aa373c11756bbd353bfe77819f5d777598.zip cpython-cff311aa373c11756bbd353bfe77819f5d777598.tar.gz cpython-cff311aa373c11756bbd353bfe77819f5d777598.tar.bz2 |
Be more careful than the previous patch. The default content-type
should only be set to application/x-www-form-urlencoded when the
method is POST. E.g. for PUT, an empty default (defaulting to
text/plain later) makes more sense.
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-x | Lib/cgi.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -802,7 +802,10 @@ class FieldStorage: headers = {'content-type': "application/x-www-form-urlencoded"} if headers is None: - headers = {'content-type': "application/x-www-form-urlencoded"} + headers = {} + if method == 'POST': + # Set default content-type for POST to what's traditional + headers['content-type'] = "application/x-www-form-urlencoded" if environ.has_key('CONTENT_TYPE'): headers['content-type'] = environ['CONTENT_TYPE'] if environ.has_key('CONTENT_LENGTH'): |