From 21b5679f1b3d64efab87efd64ffa39b09cb94d8c Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 8 Feb 2017 10:29:29 -0800 Subject: [PATCH] droppped HttpPrefixParser #1590 --- CHANGES.rst | 2 ++ aiohttp/protocol.py | 26 +------------------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index dc5ccaa0076..efc809a53a6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,3 +3,5 @@ CHANGES 1.4.0 (XXXX-XX-XX) ------------------ + +- Dropped: `aiohttp.protocol.HttpPrefixParser` #1590 diff --git a/aiohttp/protocol.py b/aiohttp/protocol.py index ef60be7cdcb..b876922bf3f 100644 --- a/aiohttp/protocol.py +++ b/aiohttp/protocol.py @@ -20,8 +20,7 @@ __all__ = ('HttpMessage', 'Request', 'Response', 'HttpVersion', 'HttpVersion10', 'HttpVersion11', 'RawRequestMessage', 'RawResponseMessage', - 'HttpPrefixParser', 'HttpRequestParser', 'HttpResponseParser', - 'HttpPayloadParser') + 'HttpRequestParser', 'HttpResponseParser', 'HttpPayloadParser') ASCIISET = set(string.printable) METHRE = re.compile('[A-Z0-9$-_.]+') @@ -141,29 +140,6 @@ def parse_headers(self, lines): return headers, raw_headers, close_conn, encoding -class HttpPrefixParser: - """Waits for 'HTTP' prefix (non destructive)""" - - def __init__(self, allowed_methods=()): - self.allowed_methods = [m.upper() for m in allowed_methods] - - def __call__(self, out, buf): - raw_data = yield from buf.waituntil(b' ', 12) - method = raw_data.decode('ascii', 'surrogateescape').strip() - - # method - method = method.upper() - if not METHRE.match(method): - raise errors.BadStatusLine(method) - - # allowed method - if self.allowed_methods and method not in self.allowed_methods: - raise errors.HttpMethodNotAllowed(message=method) - - out.feed_data(method, len(method)) - out.feed_eof() - - class HttpRequestParser(HttpParser): """Read request status line. Exception errors.BadStatusLine could be raised in case of any errors in status line.