summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-02 18:44:22 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-02 18:44:22 (GMT)
commitce900defc57eb8d38ad5da8416ff0ded08df34c3 (patch)
tree14762ee03adfb1b75eedb5535030508e2ee87084 /Lib
parent094189f10846112494ded420e5232ee9343f01c4 (diff)
downloadcpython-ce900defc57eb8d38ad5da8416ff0ded08df34c3.zip
cpython-ce900defc57eb8d38ad5da8416ff0ded08df34c3.tar.gz
cpython-ce900defc57eb8d38ad5da8416ff0ded08df34c3.tar.bz2
At Jim Fulton's request (actually, as a compromise :-), default the
content-type to application/x-www-form-urlencoded only when the method is POST. Ditto for when the content-type is unrecognized -- only fall back to urlencoded with POST.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/cgi.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index ab6dda8..6b8d5e5 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -841,7 +841,7 @@ class FieldStorage:
# but it happens to be something we don't understand.
if self.headers.has_key('content-type'):
ctype, pdict = parse_header(self.headers['content-type'])
- elif self.outerboundary:
+ elif self.outerboundary or method != 'POST':
ctype, pdict = "text/plain", {}
else:
ctype, pdict = 'application/x-www-form-urlencoded', {}
@@ -867,7 +867,7 @@ class FieldStorage:
self.read_urlencoded()
elif ctype[:10] == 'multipart/':
self.read_multi(environ, keep_blank_values, strict_parsing)
- elif self.outerboundary:
+ elif self.outerboundary or method != 'POST':
# we're in an inner part, but the content-type wasn't something we
# understood. default to read_single() because the resulting
# FieldStorage won't be a mapping (and doesn't need to be).