(self, key, value, prefix=0,
                  add_to_http_hdrs=0)
prefix is ignored if add_to_http_hdrs is true.
prefix is ignored if add_to_http_hdrs is true.
prefix is ignored if add_to_http_hdrs is true .
def addheader(self, key, value, prefix=0,
                  add_to_http_hdrs=0):
        """
        prefix is ignored if add_to_http_hdrs is true.
        """
        lines = value.split("\r\n")
        while lines and not lines[-1]: del lines[-1]
        while lines and not lines[0]: del lines[0]
        if add_to_http_hdrs:
            value = "".join(lines)
            # 2.2 urllib2 doesn't normalize header case
            self._http_hdrs.append((key.capitalize(), value))
        else:
            for i in xrange(1, len(lines)):
                lines[i] = "    " + lines[i].strip()
            value = "\r\n".join(lines) + "\r\n"
            line = key.title() + ": " + value
            if prefix:
                self._headers.insert(0, line)
            else:
                self._headers.append(line)
def addheader ( self , key , value , prefix = 0 , add_to_http_hdrs = 0 ) : lines = value . split ( "\r\n" ) while lines and not lines [ - 1 ] : del lines [ - 1 ] while lines and not lines [ 0 ] : del lines [ 0 ] if add_to_http_hdrs : value = "" . join ( lines ) # 2.2 urllib2 doesn't normalize header case self . _http_hdrs . append ( ( key . capitalize ( ) , value ) ) else : for i in xrange ( 1 , len ( lines ) ) : lines [ i ] = "    " + lines [ i ] . strip ( ) value = "\r\n" . join ( lines ) + "\r\n" line = key . title ( ) + ": " + value if prefix : self . _headers . insert ( 0 , line ) else : self . _headers . append ( line )