def __init__(self, kind=2, decompress=False): self.kind = kind self.decompress = decompress # errors vars self.errno = None self.errstr = "" # protected variables self._buf = [] self._version = None self._method = None self._status_code = None self._status = None self._reason = None self._url = None self._path = None self._query_string = None self._fragment= None self._headers = IOrderedDict() self._environ = dict() self._chunked = False self._body = [] self._trailers = None self._partial_body = False self._clen = None self._clen_rest = None # private events self.__on_firstline = False self.__on_headers_complete = False self.__on_message_begin = False self.__on_message_complete = False self.__decompress_obj = None
def inner(status, headers): headers_obj = IOrderedDict(headers) if 'Set-Cookie' in headers_obj and ', ' in headers_obj['Set-Cookie']: cookie = SimpleCookie() cookie.load(headers_obj['Set-Cookie']) del headers_obj['Set-Cookie'] headers_list = headers_obj.items() for key in ("auctions_loggedin", "auction_session"): if key in cookie: headers_list += [ ('Set-Cookie', cookie[key].output(header="").lstrip().rstrip(',')) ] headers = headers_list return start_response_decorated(status, headers)
def __init__(self, code: int, content: Union[bytes, str] = b''): self.content = to_bytes(content) self.response_code = code self.headers = IOrderedDict() self._standard_headers()