parameters: (self)
docstring: Parse HTTP header data into Python structures. (Core)
docstring_summary: Parse HTTP header data into Python structures. (Core)
docstring_tokens: Parse HTTP header data into Python structures . ( Core )
function: def process_headers(self):
          """Parse HTTP header data into Python structures. (Core)"""
          # Process the headers into self.headers
          headers = self.headers
          for name, value in self.header_list:
              # Call title() now (and use dict.__method__(headers))
              # so title doesn't have to be called twice.
              name = name.title()
              value = value.strip()
              
              # Warning: if there is more than one header entry for cookies (AFAIK,
              # only Konqueror does that), only the last one will remain in headers
              # (but they will be correctly stored in request.cookie).
              if "=?" in value:
                  dict.__setitem__(headers, name, httputil.decode_TEXT(value))
              else:
                  dict.__setitem__(headers, name, value)
              
              # Handle cookies differently because on Konqueror, multiple
              # cookies come on different lines with the same key
              if name == 'Cookie':
                  try:
                      self.cookie.load(value)
                  except CookieError:
                      msg = "Illegal cookie name %s" % value.split('=')[0]
                      raise cherrypy.HTTPError(400, msg)
          
          if not dict.__contains__(headers, 'Host'):
              # All Internet-based HTTP/1.1 servers MUST respond with a 400
              # (Bad Request) status code to any HTTP/1.1 request message
              # which lacks a Host header field.
              if self.protocol >= (1, 1):
                  msg = "HTTP/1.1 requires a 'Host' request header."
                  raise cherrypy.HTTPError(400, msg)
          host = dict.get(headers, 'Host')
          if not host:
              host = self.local.name or self.local.ip
          self.base = "%s://%s" % (self.scheme, host)
function_tokens: def process_headers ( self ) : # Process the headers into self.headers headers = self . headers for name , value in self . header_list : # Call title() now (and use dict.__method__(headers)) # so title doesn't have to be called twice. name = name . title ( ) value = value . strip ( ) # Warning: if there is more than one header entry for cookies (AFAIK, # only Konqueror does that), only the last one will remain in headers # (but they will be correctly stored in request.cookie). if "=?" in value : dict . __setitem__ ( headers , name , httputil . decode_TEXT ( value ) ) else : dict . __setitem__ ( headers , name , value ) # Handle cookies differently because on Konqueror, multiple # cookies come on different lines with the same key if name == 'Cookie' : try : self . cookie . load ( value ) except CookieError : msg = "Illegal cookie name %s" % value . split ( '=' ) [ 0 ] raise cherrypy . HTTPError ( 400 , msg ) if not dict . __contains__ ( headers , 'Host' ) : # All Internet-based HTTP/1.1 servers MUST respond with a 400 # (Bad Request) status code to any HTTP/1.1 request message # which lacks a Host header field. if self . protocol >= ( 1 , 1 ) : msg = "HTTP/1.1 requires a 'Host' request header." raise cherrypy . HTTPError ( 400 , msg ) host = dict . get ( headers , 'Host' ) if not host : host = self . local . name or self . local . ip self . base = "%s://%s" % ( self . scheme , host )