Update lib: Tornado

This commit is contained in:
Ruud
2014-08-30 14:01:12 +02:00
parent 73d37584ad
commit e0dffe20a4
21 changed files with 504 additions and 605 deletions
+14 -14
View File
@@ -319,7 +319,7 @@ class HTTPServerRequest(object):
are typically kept open in HTTP/1.1, multiple requests can be handled
sequentially on a single connection.
.. versionchanged:: 3.3
.. versionchanged:: 4.0
Moved from ``tornado.httpserver.HTTPRequest``.
"""
def __init__(self, method=None, uri=None, version="HTTP/1.0", headers=None,
@@ -352,7 +352,7 @@ class HTTPServerRequest(object):
def supports_http_1_1(self):
"""Returns True if this request supports HTTP/1.1 semantics.
.. deprecated:: 3.3
.. deprecated:: 4.0
Applications are less likely to need this information with the
introduction of `.HTTPConnection`. If you still need it, access
the ``version`` attribute directly.
@@ -375,7 +375,7 @@ class HTTPServerRequest(object):
def write(self, chunk, callback=None):
"""Writes the given chunk to the response stream.
.. deprecated:: 3.3
.. deprecated:: 4.0
Use ``request.connection`` and the `.HTTPConnection` methods
to write the response.
"""
@@ -385,7 +385,7 @@ class HTTPServerRequest(object):
def finish(self):
"""Finishes this HTTP request on the open connection.
.. deprecated:: 3.3
.. deprecated:: 4.0
Use ``request.connection`` and the `.HTTPConnection` methods
to write the response.
"""
@@ -445,19 +445,19 @@ class HTTPServerRequest(object):
self.__class__.__name__, args, dict(self.headers))
class HTTPInputException(Exception):
class HTTPInputError(Exception):
"""Exception class for malformed HTTP requests or responses
from remote sources.
.. versionadded:: 3.3
.. versionadded:: 4.0
"""
pass
class HTTPOutputException(Exception):
class HTTPOutputError(Exception):
"""Exception class for errors in HTTP output.
.. versionadded:: 3.3
.. versionadded:: 4.0
"""
pass
@@ -465,7 +465,7 @@ class HTTPOutputException(Exception):
class HTTPServerConnectionDelegate(object):
"""Implement this interface to handle requests from `.HTTPServer`.
.. versionadded:: 3.3
.. versionadded:: 4.0
"""
def start_request(self, server_conn, request_conn):
"""This method is called by the server when a new request has started.
@@ -491,7 +491,7 @@ class HTTPServerConnectionDelegate(object):
class HTTPMessageDelegate(object):
"""Implement this interface to handle an HTTP request or response.
.. versionadded:: 3.3
.. versionadded:: 4.0
"""
def headers_received(self, start_line, headers):
"""Called when the HTTP headers have been received and parsed.
@@ -531,7 +531,7 @@ class HTTPMessageDelegate(object):
class HTTPConnection(object):
"""Applications use this interface to write their responses.
.. versionadded:: 3.3
.. versionadded:: 4.0
"""
def write_headers(self, start_line, headers, chunk=None, callback=None):
"""Write an HTTP header block.
@@ -774,9 +774,9 @@ def parse_request_start_line(line):
try:
method, path, version = line.split(" ")
except ValueError:
raise HTTPInputException("Malformed HTTP request line")
raise HTTPInputError("Malformed HTTP request line")
if not version.startswith("HTTP/"):
raise HTTPInputException(
raise HTTPInputError(
"Malformed HTTP version in HTTP Request-Line: %r" % version)
return RequestStartLine(method, path, version)
@@ -796,7 +796,7 @@ def parse_response_start_line(line):
line = native_str(line)
match = re.match("(HTTP/1.[01]) ([0-9]+) ([^\r]*)", line)
if not match:
raise HTTPInputException("Error parsing response start line")
raise HTTPInputError("Error parsing response start line")
return ResponseStartLine(match.group(1), int(match.group(2)),
match.group(3))