mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
parent
5b68c17b17
commit
97f87ec13e
@ -53,7 +53,7 @@ class InvalidHTTPVersion(ParseException):
|
|||||||
self.version = version
|
self.version = version
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Invalid HTTP Version: %r" % self.version
|
return "Invalid HTTP Version: %r" % (self.version,)
|
||||||
|
|
||||||
|
|
||||||
class InvalidHeader(ParseException):
|
class InvalidHeader(ParseException):
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from gunicorn import util
|
|||||||
from gunicorn.http.body import Body, LengthReader, EOFReader
|
from gunicorn.http.body import Body, LengthReader, EOFReader
|
||||||
from gunicorn.http.wsgi import Response
|
from gunicorn.http.wsgi import Response
|
||||||
from gunicorn.http.unreader import Unreader, IterUnreader, SocketUnreader
|
from gunicorn.http.unreader import Unreader, IterUnreader, SocketUnreader
|
||||||
from gunicorn.http.errors import InvalidHeader, InvalidHeaderName
|
from gunicorn.http.errors import InvalidHeader, InvalidHeaderName, InvalidHTTPVersion
|
||||||
from gunicorn.http.message import TOKEN_RE
|
from gunicorn.http.message import TOKEN_RE
|
||||||
|
|
||||||
|
|
||||||
@ -238,3 +238,8 @@ def test_eof_reader_read_invalid_size():
|
|||||||
reader.read([100])
|
reader.read([100])
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
reader.read(-100)
|
reader.read(-100)
|
||||||
|
|
||||||
|
|
||||||
|
def test_invalid_http_version_error():
|
||||||
|
assert str(InvalidHTTPVersion('foo')) == "Invalid HTTP Version: 'foo'"
|
||||||
|
assert str(InvalidHTTPVersion((2, 1))) == 'Invalid HTTP Version: (2, 1)'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user