def start_response(self, status, response_headers): self.response_status = status for name, value in response_headers: name = normalize_name(name) if not isinstance(value, basestring): value = str(value) self.response_headers[name] = value.strip() self.start_response_called = True
def start_response(self, status, response_headers, exc_info=None): if exc_info: try: if self.start_response_called: raise exc_info[0], exc_info[1], exc_info[2] finally: exc_info = None elif self.start_response_called: raise AssertionError("Response headers already set!") self.response_status = status for name, value in response_headers: name = normalize_name(name) if not isinstance(value, basestring): value = str(value) self.response_headers[name] = value.strip() self.start_response_called = True
def _parse_headerl(self, hdrs, line): """ parse header line""" name, value = line.split(":", 1) name = normalize_name(name.strip()) hdrs[name] = value.rsplit("\r\n",1)[0].strip() return name
def _parse_headerl(self, hdrs, line): """ parse header line""" name, value = line.split(":", 1) name = normalize_name(name.strip()) hdrs[name] = value.rsplit("\r\n", 1)[0].strip() return name