]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fixes based on code review. 1053/head
authordano <oreilldf@gmail.com>
Mon, 19 May 2014 15:38:23 +0000 (11:38 -0400)
committerdano <oreilldf@gmail.com>
Mon, 19 May 2014 15:38:23 +0000 (11:38 -0400)
Don't fall through if regex doesn't match.
Use 'X-HTTP-Reason' instead of 'Reason'.

tornado/curl_httpclient.py

index c489f00fb4c3747ffc1df21da1b422a7eb378fc4..26401e3ec3e2ae09448ac7ec52f612aacaa54bf3 100644 (file)
@@ -268,7 +268,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
             info["callback"](HTTPResponse(
                 request=info["request"], code=code, headers=info["headers"],
                 buffer=buffer, effective_url=effective_url, error=error,
-                reason=info['headers'].get("reason", None),
+                reason=info['headers'].get("x-http-reason", None),
                 request_time=time.time() - info["curl_start_time"],
                 time_info=time_info))
         except Exception:
@@ -473,9 +473,9 @@ def _curl_header_callback(headers, header_line):
         headers.clear()
         try:
             (__, __, reason) = httputil.parse_response_start_line(header_line)
-            header_line = "Reason: %s" % reason
+            header_line = "X-HTTP-Reason: %s" % reason
         except AssertionError:
-            pass
+            return
     if not header_line:
         return
     headers.parse_line(header_line)