def __init__(self, inp=None, method=None, path=None): BaseHttp.__init__(self) if inp is not None: self.read_content(inp) self.method = method or 'GET' if path is not None: self.path = path if not isinstance(path, bytes) else path.decode()
def read_content(self, data): if data is None or len(data) == 0: return 0 hdr = self.header.finished rv = BaseHttp.read_content(self, data) if hdr is False and self.header.finished: self.method, self.path, self.http = self.header.status_line.split(' ') return rv
def read_content(self, data): if data is None or len(data) == 0: return 0 hdr = self.header.finished rv = BaseHttp.read_content(self, data) if hdr is False and self.header.finished: self.method, self.path, self.http = self.header.status_line.split( ' ') return rv
def read_content(self, data): if data is None or len(data) == 0: return 0 hdr = self.header.finished rv = BaseHttp.read_content(self, data) if hdr is False and self.header.finished: self.http, self.code, self.msg = self.header.status_line.split(' ', 2) self.code = int(self.code) return rv
def read_content(self, data): if data is None or len(data) == 0: return 0 hdr = self.header.finished rv = BaseHttp.read_content(self, data) if hdr is False and self.header.finished: self.http, self.code, self.msg = self.header.status_line.split( ' ', 2) self.code = int(self.code) return rv
def __init__(self, inp=None, code=None): BaseHttp.__init__(self) self.msg = 'OK' self.code = code or 200 if inp is not None: self.read_content(inp)