]> granicus.if.org Git - python/commitdiff
Be more careful than the previous patch. The default content-type
authorGuido van Rossum <guido@python.org>
Thu, 11 Jun 1998 14:06:59 +0000 (14:06 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 11 Jun 1998 14:06:59 +0000 (14:06 +0000)
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.

Lib/cgi.py

index 5493092340be1695f88cb4396c5d169ce8e01d19..d45ed266eedd16219619830646a011ec650e413a 100755 (executable)
@@ -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'):