Merge pull request #943 from crvv/master
fix #763, sanic can't decode latin1 encoded header value
This commit is contained in:
commit
9fb8bec715
|
@ -189,10 +189,12 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
and int(value) > self.request_max_size:
|
and int(value) > self.request_max_size:
|
||||||
exception = PayloadTooLarge('Payload Too Large')
|
exception = PayloadTooLarge('Payload Too Large')
|
||||||
self.write_error(exception)
|
self.write_error(exception)
|
||||||
|
try:
|
||||||
|
value = value.decode()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
value = value.decode('latin_1')
|
||||||
self.headers.append(
|
self.headers.append(
|
||||||
(self._header_fragment.decode().casefold(),
|
(self._header_fragment.decode().casefold(), value))
|
||||||
value.decode()))
|
|
||||||
|
|
||||||
self._header_fragment = b''
|
self._header_fragment = b''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user