From: Guido van Rossum Date: Thu, 11 Jun 1998 14:06:59 +0000 (+0000) Subject: Be more careful than the previous patch. The default content-type X-Git-Tag: v1.5.2a1~488 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cff311aa373c11756bbd353bfe77819f5d777598;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/cgi.py b/Lib/cgi.py index 5493092340be..d45ed266eedd 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -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'):