parameters: (self, method, path, query_string, req_protocol, headers, rfile)
return_statement: return response
docstring: r"""Process the Request. (Core)
          
          method, path, query_string, and req_protocol should be pulled directly
          from the Request-Line (e.g. "GET /path?key=val HTTP/1.0").
          
          path
              This should be %XX-unquoted, but query_string should not be.
              
              When using Python 2, they both MUST be byte strings,
              not unicode strings.
              
              When using Python 3, they both MUST be unicode strings,
              not byte strings, and preferably not bytes \x00-\xFF
              disguised as unicode.
          
          headers
              A list of (name, value) tuples.
          
          rfile
              A file-like object containing the HTTP request entity.
          
          When run() is done, the returned object should have 3 attributes:
          
            * status, e.g. "200 OK"
            * header_list, a list of (name, value) tuples
            * body, an iterable yielding strings
          
          Consumer code (HTTP servers) should then access these response
          attributes to build the outbound stream.
docstring_summary: r"""Process the Request. (Core)
          
          method, path, query_string, and req_protocol should be pulled directly
          from the Request-Line (e.g. "GET /path?key=val HTTP/1.0").
          
          path
              This should be %XX-unquoted, but query_string should not be.
              
              When using Python 2, they both MUST be byte strings,
              not unicode strings.
              
              When using Python 3, they both MUST be unicode strings,
              not byte strings, and preferably not bytes \x00-\xFF
              disguised as unicode.
          
          headers
              A list of (name, value) tuples.
          
          rfile
              A file-like object containing the HTTP request entity.
          
          When run() is done, the returned object should have 3 attributes:
          
            * status, e.g. "200 OK"
            * header_list, a list of (name, value) tuples
            * body, an iterable yielding strings
          
          Consumer code (HTTP servers) should then access these response
          attributes to build the outbound stream.
docstring_tokens: r Process the Request . ( Core ) method path query_string and req_protocol should be pulled directly from the Request - Line ( e . g . GET / path?key = val HTTP / 1 . 0 ) . path This should be %XX - unquoted but query_string should not be . When using Python 2 they both MUST be byte strings not unicode strings . When using Python 3 they both MUST be unicode strings not byte strings and preferably not bytes \ x00 - \ xFF disguised as unicode . headers A list of ( name value ) tuples . rfile A file - like object containing the HTTP request entity . When run () is done the returned object should have 3 attributes : * status e . g . 200 OK * header_list a list of ( name value ) tuples * body an iterable yielding strings Consumer code ( HTTP servers ) should then access these response attributes to build the outbound stream .
function: def run(self, method, path, query_string, req_protocol, headers, rfile):
          r"""Process the Request. (Core)
          
          method, path, query_string, and req_protocol should be pulled directly
          from the Request-Line (e.g. "GET /path?key=val HTTP/1.0").
          
          path
              This should be %XX-unquoted, but query_string should not be.
              
              When using Python 2, they both MUST be byte strings,
              not unicode strings.
              
              When using Python 3, they both MUST be unicode strings,
              not byte strings, and preferably not bytes \x00-\xFF
              disguised as unicode.
          
          headers
              A list of (name, value) tuples.
          
          rfile
              A file-like object containing the HTTP request entity.
          
          When run() is done, the returned object should have 3 attributes:
          
            * status, e.g. "200 OK"
            * header_list, a list of (name, value) tuples
            * body, an iterable yielding strings
          
          Consumer code (HTTP servers) should then access these response
          attributes to build the outbound stream.
          
          """
          response = cherrypy.serving.response
          self.stage = 'run'
          try:
              self.error_response = cherrypy.HTTPError(500).set_response
              
              self.method = method
              path = path or "/"
              self.query_string = query_string or ''
              self.params = {}
              
              # Compare request and server HTTP protocol versions, in case our
              # server does not support the requested protocol. Limit our output
              # to min(req, server). We want the following output:
              #     request    server     actual written   supported response
              #     protocol   protocol  response protocol    feature set
              # a     1.0        1.0           1.0                1.0
              # b     1.0        1.1           1.1                1.0
              # c     1.1        1.0           1.0                1.0
              # d     1.1        1.1           1.1                1.1
              # Notice that, in (b), the response will be "HTTP/1.1" even though
              # the client only understands 1.0. RFC 2616 10.5.6 says we should
              # only return 505 if the _major_ version is different.
              rp = int(req_protocol[5]), int(req_protocol[7])
              sp = int(self.server_protocol[5]), int(self.server_protocol[7])
              self.protocol = min(rp, sp)
              response.headers.protocol = self.protocol
              
              # Rebuild first line of the request (e.g. "GET /path HTTP/1.0").
              url = path
              if query_string:
                  url += '?' + query_string
              self.request_line = '%s %s %s' % (method, url, req_protocol)
              
              self.header_list = list(headers)
              self.headers = httputil.HeaderMap()
              
              self.rfile = rfile
              self.body = None
              
              self.cookie = SimpleCookie()
              self.handler = None
              
              # path_info should be the path from the
              # app root (script_name) to the handler.
              self.script_name = self.app.script_name
              self.path_info = pi = path[len(self.script_name):]
              
              self.stage = 'respond'
              self.respond(pi)
              
          except self.throws:
              raise
          except:
              if self.throw_errors:
                  raise
              else:
                  # Failure in setup, error handler or finalize. Bypass them.
                  # Can't use handle_error because we may not have hooks yet.
                  cherrypy.log(traceback=True, severity=40)
                  if self.show_tracebacks:
                      body = format_exc()
                  else:
                      body = ""
                  r = bare_error(body)
                  response.output_status, response.header_list, response.body = r
          
          if self.method == "HEAD":
              # HEAD requests MUST NOT return a message-body in the response.
              response.body = []
          
          try:
              cherrypy.log.access()
          except:
              cherrypy.log.error(traceback=True)
          
          if response.timed_out:
              raise cherrypy.TimeoutError()
          
          return response
function_tokens: def run ( self , method , path , query_string , req_protocol , headers , rfile ) : response = cherrypy . serving . response self . stage = 'run' try : self . error_response = cherrypy . HTTPError ( 500 ) . set_response self . method = method path = path or "/" self . query_string = query_string or '' self . params = { } # Compare request and server HTTP protocol versions, in case our # server does not support the requested protocol. Limit our output # to min(req, server). We want the following output: #     request    server     actual written   supported response #     protocol   protocol  response protocol    feature set # a     1.0        1.0           1.0                1.0 # b     1.0        1.1           1.1                1.0 # c     1.1        1.0           1.0                1.0 # d     1.1        1.1           1.1                1.1 # Notice that, in (b), the response will be "HTTP/1.1" even though # the client only understands 1.0. RFC 2616 10.5.6 says we should # only return 505 if the _major_ version is different. rp = int ( req_protocol [ 5 ] ) , int ( req_protocol [ 7 ] ) sp = int ( self . server_protocol [ 5 ] ) , int ( self . server_protocol [ 7 ] ) self . protocol = min ( rp , sp ) response . headers . protocol = self . protocol # Rebuild first line of the request (e.g. "GET /path HTTP/1.0"). url = path if query_string : url += '?' + query_string self . request_line = '%s %s %s' % ( method , url , req_protocol ) self . header_list = list ( headers ) self . headers = httputil . HeaderMap ( ) self . rfile = rfile self . body = None self . cookie = SimpleCookie ( ) self . handler = None # path_info should be the path from the # app root (script_name) to the handler. self . script_name = self . app . script_name self . path_info = pi = path [ len ( self . script_name ) : ] self . stage = 'respond' self . respond ( pi ) except self . throws : raise except : if self . throw_errors : raise else : # Failure in setup, error handler or finalize. Bypass them. # Can't use handle_error because we may not have hooks yet. cherrypy . log ( traceback = True , severity = 40 ) if self . show_tracebacks : body = format_exc ( ) else : body = "" r = bare_error ( body ) response . output_status , response . header_list , response . body = r if self . method == "HEAD" : # HEAD requests MUST NOT return a message-body in the response. response . body = [ ] try : cherrypy . log . access ( ) except : cherrypy . log . error ( traceback = True ) if response . timed_out : raise cherrypy . TimeoutError ( ) return response