[issue5340] Change in cgi behavior breaks existing software

Bob Kline report at bugs.python.org
Sat Feb 21 20:11:52 CET 2009


New submission from Bob Kline <bkline at rksystems.com>:

We just upgraded Python to 2.6 on some of our servers and a number of
our CGI scripts broke because the cgi module has changed the way it
handles POST requests.  When the 'action' attribute was not present in
the form element on an HTML page the module behaved as if the value of
the attribute was the URL which brought the user to the page with the
form, but without the query (?x=y...) part.  Now FieldStorage.getvalue()
is giving the script a list of two copies of the value for some of the
parameters (folding in the parameters from the previous request) instead
of the single string it used to return for each.  I searched the python
mailing list looking for a discussion of the proposal to impose this
change of behavior, and perhaps I wasn't using the right phrases in my
search, but I didn't find anything.  I didn't get many responses when I
asked for pointers to this discussion, but the few I did get were from
people who were as surprised as we were.  It's not clear to us (or to
those who responded on the mailing list) that the applicable RFCs
provide completely clear and unambiguous guidance as to which behavior
is correct, but even if the new behavior is correct, it is unusual to
have changes to the library which break existing code introduced without
any discussion of the impact, or transition period, or options to
preserve the previous behavior.  For what it's worth, it appears that
Perl and PHP (which probably account for the bulk of non-Python CGI
scripts in the wild) both behave the way the pre-2.6 cgi module did.  We
have a workaround (modify all our CGI scripts to explicitly set the
action attribute without the parameter suffix), but I was asked by one
of the regulars on the mailing list to file a bug report here, so I'm
complying with that request.

It appears that the breaking change was introduced with
http://svn.python.org/view?rev=64447&view=rev in connection with
http://bugs.python.org/issue1817.

See
http://mail.python.org/pipermail/python-list/2009-February/529130.html
for repro instructions.

----------
components: Library (Lib)
messages: 82575
nosy: bkline
severity: normal
status: open
title: Change in cgi behavior breaks existing software
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5340>
_______________________________________


More information about the Python-bugs-list mailing list