def send_response(req, status, headers, body, stream=False):
    """Send the HTTP response to the client."""
    # Set response status
    req.status = int(status[:3])

    # Set response headers
    req.content_type = 'text/plain'
    for header, value in headers:
        if header.lower() == 'content-type':
            req.content_type = value
            continue
        req.headers_out.add(header, value)

    if stream:
        # Flush now so the status and headers are sent immediately.
        req.flush()

    # Set response body
    for seg in always_iterable(body):
        req.write(seg)
Send the HTTP response to the client.
cherrypy/_cpmodpy.py