X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/blobdiff_plain/cf7c527a2fbf15ab8f9c1064e9f1cda55b8bb2b6..f2e194ee85b9538d5168fe776e1cdbc00ce8ca9d:/cgi.py?ds=sidebyside diff --git a/cgi.py b/cgi.py index d66bfc6..1aa2917 100644 --- a/cgi.py +++ b/cgi.py @@ -311,6 +311,7 @@ def cgi_errors(hook = None): ### CGI input. ## Lots of global variables to be filled in by `cgiparse'. +METHOD = None COOKIE = {} SPECIAL = {} PARAM = [] @@ -377,20 +378,20 @@ def cgiparse(): True if the client connection is carried over SSL or TLS. """ - global SSLP + global METHOD, SSLP def getenv(var): try: return ENV[var] except KeyError: raise U.ExpectedError, (500, "No `%s' supplied" % var) ## Yes, we want the request method. - method = getenv('REQUEST_METHOD') + METHOD = getenv('REQUEST_METHOD') ## Acquire the query string. - if method == 'GET': + if METHOD == 'GET': q = getenv('QUERY_STRING') - elif method == 'POST': + elif METHOD == 'POST': ## We must read the query string from stdin. n = getenv('CONTENT_LENGTH') @@ -404,7 +405,7 @@ def cgiparse(): raise U.ExpectedError, (500, "Failed to read correct length") else: - raise U.ExpectedError, (500, "Unexpected request method `%s'" % method) + raise U.ExpectedError, (500, "Unexpected request method `%s'" % METHOD) ## Populate the `SPECIAL', `PARAM' and `PARAMDICT' tables. seen = set()