]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Merge pull request #1042 from moijes12/fix1033_2
authorBen Darnell <ben@bendarnell.com>
Fri, 9 May 2014 00:54:42 +0000 (20:54 -0400)
committerBen Darnell <ben@bendarnell.com>
Fri, 9 May 2014 00:54:42 +0000 (20:54 -0400)
Changed _on_close method tornado/simple_httpclient.py to raise the error instead of raising an HTTPError

1  2 
tornado/simple_httpclient.py

index 511141e1dbfa16f4d0341ccf052c02f667b63a07,d5b980611627a6fba08ce951afaf8f4b3f1a2e71..d35ff1defa17f944d066fd8f132a38db17eaa5b2
@@@ -423,16 -371,25 +423,16 @@@ class _HTTPConnection(httputil.HTTPMess
          if self.final_callback is not None:
              message = "Connection closed"
              if self.stream.error:
-                 message = str(self.stream.error)
+                 raise self.stream.error
              raise HTTPError(599, message)
  
 -    def _handle_1xx(self, code):
 -        self.stream.read_until_regex(b"\r?\n\r?\n", self._on_headers)
 -
 -    def _on_headers(self, data):
 -        data = native_str(data.decode("latin1"))
 -        first_line, _, header_data = data.partition("\n")
 -        match = re.match("HTTP/1.[01] ([0-9]+) ([^\r]*)", first_line)
 -        assert match
 -        code = int(match.group(1))
 -        self.headers = HTTPHeaders.parse(header_data)
 -        if 100 <= code < 200:
 -            self._handle_1xx(code)
 +    def headers_received(self, first_line, headers):
 +        if self.request.expect_100_continue and first_line.code == 100:
 +            self._write_body(False)
              return
 -        else:
 -            self.code = code
 -            self.reason = match.group(2)
 +        self.headers = headers
 +        self.code = first_line.code
 +        self.reason = first_line.reason
  
          if "Content-Length" in self.headers:
              if "," in self.headers["Content-Length"]: