for h in O.http_headers(content_type = content_type, **kw):
me.writeln(h)
me.writeln('')
+ if METHOD == 'HEAD':
+ HEADER_DONE()
def cookie(name, value, **kw):
"""
PARAMDICT = {}
PATH = []
SSLP = False
+HEADER_DONE = lambda: None
## Regular expressions for splitting apart query and cookie strings.
R_QSPLIT = RX.compile('[;&]')
METHOD = getenv('REQUEST_METHOD')
## Acquire the query string.
- if METHOD == 'GET':
+ if METHOD in ['GET', 'HEAD']:
q = getenv('QUERY_STRING')
elif METHOD == 'POST':
if not n.isdigit():
raise U.ExpectedError, (500, "Invalid CONTENT_LENGTH")
n = int(n, 10)
- if getenv('CONTENT_TYPE') != 'application/x-www-form-urlencoded':
+ ct = getenv('CONTENT_TYPE')
+ if ct != 'application/x-www-form-urlencoded':
raise U.ExpectedError, (500, "Unexpected content type `%s'" % ct)
q = SYS.stdin.read(n)
if len(q) != n:
the list of path elements is non-empty.
"""
+ global HEADER_DONE
+
## We're going to make a pass over the supplied parameters, and we'll
## check them off against the formal parameters as we go; so we'll need
## to be able to look them up. We'll also keep track of the ones we've