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':
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
## over HTTP is done in `dispatch_cgi'.
with OUT.redirect_to(CGI.HTTPOutput()):
- with CGI.cgi_errors(cgi_setup): dispatch_cgi()
+ with U.Escape() as CGI.HEADER_DONE:
+ with CGI.cgi_errors(cgi_setup):
+ dispatch_cgi()
elif 'USERV_SERVICE' in ENV:
## This is a Userv request. The caller's user name is helpfully in the