'Send common HTTP headers plus a list of custom headers:
- Cache-Control
- Content-Type
This function does not send the HTTP/1.1 header, so
ensure self.send_http_response() was called before
Keyword arguments:
header_list  -- A list of custom headers to send, containing
key-value tuples
cachectrl    -- The value of the \'Cache-Control\' header field
mimetype     -- The MIME type to send as \'Content-Type\' value'

def send_standard_headers(self, header_list=[], cachectrl='private', mimetype='text/html'):

    if (mimetype.startswith('text/') and (';' not in mimetype)):
        mimetype += ';    charset    =    utf-8'
    self.send_header('Cache-Control', cachectrl)
    self.send_header('Content-Security-Policy', security.http_content_security_policy(self.server))
    self.send_header('Content-Type', mimetype)
    for header in header_list:
        self.send_header(header[0], header[1])
    session_id = self.session.ui.html_variables.get('http_session')
    if session_id:
        cookies = Cookie.SimpleCookie()
        cookies[self.server.session_cookie] = session_id
        cookies[self.server.session_cookie]['path'] = '/'
        cookies[self.server.session_cookie]['max-age'] = (24 * 3600)
        self.send_header(*cookies.output().split(':    ', 1))
    if mailpile.util.QUITTING:
        self.send_header('Connection', 'close')
    self.end_headers()
