'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.'

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 = {}
        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
        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
        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:
            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'):
        response.body = []
    try:
        cherrypy.log.access()
    except:
        cherrypy.log.error(traceback=True)
    if response.timed_out:
        raise cherrypy.TimeoutError()
    return response
