From: dano Date: Wed, 14 May 2014 14:48:38 +0000 (-0400) Subject: Use parse_response_start_line instead of re X-Git-Tag: v4.0.0b1~56^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5176866c68c0f4842427b986b8ac5df3cea0488c;p=thirdparty%2Ftornado.git Use parse_response_start_line instead of re --- diff --git a/tornado/curl_httpclient.py b/tornado/curl_httpclient.py index 3fc171593..c489f00fb 100644 --- a/tornado/curl_httpclient.py +++ b/tornado/curl_httpclient.py @@ -23,7 +23,6 @@ import logging import pycurl import threading import time -import re from tornado import httputil from tornado import ioloop @@ -472,9 +471,11 @@ def _curl_header_callback(headers, header_line): header_line = header_line.strip() if header_line.startswith("HTTP/"): headers.clear() - m = re.search("HTTP\/\S*\s*\d+\s*(.*?)\s*$", header_line) - if m: - header_line = "Reason: %s" % m.group(1) + try: + (__, __, reason) = httputil.parse_response_start_line(header_line) + header_line = "Reason: %s" % reason + except AssertionError: + pass if not header_line: return headers.parse_line(header_line)