summaryrefslogtreecommitdiff
path: root/Lib/cgi.py
AgeCommit message (Collapse)AuthorLines
2001-10-13"ib" should be "boundary"; reported by Neal Norwitz.Fred Drake-1/+1
2001-09-05Class FieldStorage: add two new methods, getfirst() and getlist(),Guido van Rossum-0/+22
that provide a somewhat more uniform interface to getting values. This is from SF patch #453691.
2001-08-09Whitespace normalization.Tim Peters-3/+3
2001-07-25Fix a denial-of-service attack, SF bug #443120.Guido van Rossum-4/+14
Code by Evan Simpson.
2001-06-29Solve SF bug #231249: cgi.py opens too many (temporary) files.Guido van Rossum-4/+12
class FieldStorage: this patch changes read_lines() and co. to use a StringIO() instead of a real file. The write() calls are redirected to a private method that replaces it with a real, external file only when it gets too big (> 1000 bytes). This avoids problems in forms using the multipart/form-data encoding with many fields. The original code created a temporary file for *every* field (not just for file upload fields), thereby sometimes exceeding the open file limit of some systems. Note that the simpler solution "use a real file only for file uploads" can't be used because the form field parser has no way to tell which fields correspond to file uploads. It's *possible* but extremely unlikely that this would break someone's code; they would have to be stepping way outside the documented interface for FieldStorage and use f.file.fileno(), or depend on overriding make_file() to return a file-like object with additional known properties.
2001-03-19Add a whole lot of stuff to __all__.Guido van Rossum-3/+6
(Excluding the logging stuff, which doesn't lend itself to use via "from cgi import *" -- it manipulates globals.)
2001-02-28added missing element to __all__Skip Montanaro-1/+2
2001-02-13Added a comment explaining why this file must really have #!Guido van Rossum-0/+9
/usr/local/bin/python and not #! /usr/bin/env python.
2001-02-09String method conversion.Eric S. Raymond-27/+26
2001-01-20added __all__ lists to a number of Python modulesSkip Montanaro-0/+2
added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
2001-01-14Whitespace normalization.Tim Peters-27/+27
2000-12-27Make Traceback header conform to new traceback ("innermost last" ->Guido van Rossum-1/+1
"most recent call last").
2000-11-06This fixes several bug reports concering memory bloating during largeBarry Warsaw-5/+1
file uploads. In response to SF bugs 110674 and 119806, and discussions on python-dev, we are removing the self.lines attribute from the FieldStorage class. Specifically touched where methods __init__(), read_lines_to_eof(), and skip_lines(). No one can remember why self.lines was added. Technically, it's part of the public interface for the class, but it was never documented. It's possible clever or nosy code will break because of this, but it was decided to remove it and see who complains. This resolution also closes the second half of the cgi.py entry in PEP 42. The first half of that PEP concerns specifically binary file uploads, where there may be no end-of-line marker for a very long time. This patch does not address that issue.
2000-10-03Undo Ping's change.Guido van Rossum-1/+1
CGI scripts should *not* use /usr/bin/env, since on systems that don't come standard with Python installed, Python isn't on the default $PATH. Too bad that this breaks on Linux, where Python is in /usr/bin which is on the default path -- the point is that you must manually edit your CGI scripts when you install them.
2000-10-03Change first line to #!/usr/bin/env python (really just to test check-in).Ka-Ping Yee-1/+1
2000-09-19Patch #101121, by Ka-Ping Yee: cosmetic cleanup of cgi.py, using myGuido van Rossum-37/+37
style conventions. (Ping has checkin privileges but apparently ignores them at the moment.) Ping improves a few doc strings and fixes style violations like foo ( bar ). An addition of my own: rearrange the printing of various items in test() so that the (long) environment comes at the end. This avoids having to scroll if you want to see the current directory or command line arguments.
2000-09-16Improve the test output a bit.Guido van Rossum-2/+4
2000-09-15fix bug #110661 (PR#356) -- accept either & or ; as separator for CGIJeremy Hylton-16/+15
query string also some doc string reformatting and use of string methods instead of older string.splitfields
2000-08-25Closing patch #101120 -- After everyone agreed.Moshe Zadka-23/+23
2000-08-03Remove very long doc string (it's all in the docs)Jeremy Hylton-399/+3
Modify parse_qsl to interpret 'a=b=c' as key 'a' and value 'b=c' (which matches Perl's CGI.pm)
2000-07-16Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters-6/+6
comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-02-28Simple changes by Gerrit Holl - move author acknowledgements out ofGuido van Rossum-14/+13
docstrings into comments.
2000-02-25Fix a broken r.append(name, value) call, spotted by Tim.Guido van Rossum-1/+1
1999-06-11After more discussion with Jim, change the behavior so that only aGuido van Rossum-9/+1
*missing* content-type at the outer level of a POST defaults to urlencoded. In all other circumstances, the default is read_singe().
1999-06-04Patch by Jim Fulton: new function parse_qsl(), which is likeGuido van Rossum-13/+44
parse_qs() but returns a list of (name, value) pairs -- which is actually more correct. Use this where it makes sense.
1999-06-02At Jim Fulton's request (actually, as a compromise :-), default theGuido van Rossum-2/+2
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.
1999-01-08FieldStorage.__init__(): if there is no content-type header, useBarry Warsaw-2/+24
text/plain for inner parts, but application/x-www-form-urlencoded for outer parts. Honor any existing content-type header. Lower down, if the content-type header is something we don't understand (say because it there was a typo in the header coming from the client), default to text/plain for inner parts, but application/x-www-form-urlencoded for outer parts.
1998-12-09In read_multi, allow a subclass to override the class we instantiateGuido van Rossum-4/+7
when we create a recursive instance, by setting the class variable 'FieldStorageClass' to the desired class. By default, this is set to None, in which case we use self.__class__ (as before).
1998-10-20Patch by Jim Fulton, who writes:Guido van Rossum-4/+6
""" The FieldStorage constructor calls the read_multi method. The read_multi method creates new FieldStorage objects, re-invoking the constructor (on the new objects). The problem is that the 'environ', 'keep_blank_values', and 'strict_parsing' arguments originally passed to the constructor are not propigated to the new object constructors. This causes os.environ to be used, leading to a miss-handling of the parts. I fixed this by passing these arguments to read_multi and then on to the constructor. See the context diff below. """
1998-06-25Treat "HEAD" same as "GET", so that CGI scripts won't fail.Guido van Rossum-1/+1
1998-06-11Be more careful than the previous patch. The default content-typeGuido van Rossum-1/+4
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.
1998-06-09Default content-type to application/x-www-form-urlencoded at the topGuido van Rossum-1/+1
level of a form. This means that browsers that omit the content-type header when sending a POST command aren't penalized so heavily.
1998-05-08Make Tim O'Malley's requested change: in FieldStorage.__init__(), whenGuido van Rossum-1/+2
method='GET', always get the query string from environ['QUERY_STRING'] or sys.argv[1] -- ignore an explicitly passed in fp.
1998-03-26Mass check-in after untabifying all files that need it.Guido van Rossum-529/+529
1997-12-24Use string.replace instead of regsub.[g]sub.Guido van Rossum-7/+6
1997-09-29Use sys.exc_info() where needed.Guido van Rossum-1/+2
1997-08-12Changes suggested by Jim fulton:Guido van Rossum-13/+10
- Moved most imports to the top, for faster loadingf when using ni. - Always open the temp file in binary mode.
1997-07-19Add optional 'quote' flag argument to escape(); if true, translate '"'Guido van Rossum-1/+3
to '"'.
1997-05-28Tweak default source of query a bit so it is possible to invokeGuido van Rossum-3/+6
a CGI script from the command line with not environment variables.
1997-05-28Reworded the doc string to remove the need for The Emacs font-lock kludge.Guido van Rossum-15/+13
This required (re)moving all occurrences of '(' in column 0, as well as changing "#!" to #!.
1997-05-13Untested changes by Skip Montanaro to have an optional limit on theGuido van Rossum-0/+23
size of uploads to POST (new version of these patches).
1997-04-11From: Clarence Gardner <clarence@king.silcom.com>Guido van Rossum-2/+2
The function parse_qs currently calls urllib.unquote on the value of the field submitted, but not on the name. It needs to do both.
1997-02-18Put back #! /usr/local/bin/python. For cgi scripts, /usr/bin/env isGuido van Rossum-1/+1
unlikely to find a python binary, as /usr/local/bin is usually not on the default search path.
1997-01-11Add __len__ methodGuido van Rossum-0/+4
1996-11-27/usr/local/bin/python -> /usr/bin/env pythonGuido van Rossum-2/+6
1996-11-11Added 'strict_parsing' option to all parsing functions. This causes aGuido van Rossum-11/+27
ValueError exception when the query string contains fields that don't contain exactly one '=' sign. (By default, such fields are simply ignored.) Added this to the doc string describing parse() and parse_qs(). Also changed the default for keep_blank_values from None to 0 (the preferred way to spell 'FALSE').
1996-10-24Fix truncated paragraph in doc string.Guido van Rossum-2/+3
Bump version to 2.0.
1996-09-05Added logging support.Guido van Rossum-0/+60
1996-09-05Fixed embarrassing logic bug in read_lines_to_outerboundary().Guido van Rossum-2/+3
1996-08-26Emacs font-lock de-bogo-kludgificocityGuido van Rossum-0/+2