info["callback"](HTTPResponse(
request=info["request"], code=code, headers=info["headers"],
buffer=buffer, effective_url=effective_url, error=error,
- reason=info['headers'].get("x-http-reason", None),
+ reason=info['headers'].get("X-Http-Reason", None),
request_time=time.time() - info["curl_start_time"],
time_info=time_info))
except Exception:
headers.clear()
try:
(__, __, reason) = httputil.parse_response_start_line(header_line)
- header_line = "X-HTTP-Reason: %s" % reason
- except AssertionError:
+ header_line = "X-Http-Reason: %s" % reason
+ except httputil.HTTPInputException:
return
if not header_line:
return
"""
line = native_str(line)
match = re.match("(HTTP/1.[01]) ([0-9]+) ([^\r]*)", line)
- assert match
+ if not match:
+ raise HTTPInputException("Error parsing response start line")
return ResponseStartLine(match.group(1), int(match.group(2)),
match.group(3))