Header values should be strictly ASCII but both UTF-8 and Latin-1 exist. Use UTF-8B to
cope with all.
This commit is contained in:
parent
cbfeb1c99c
commit
990ac52a1a
|
@ -120,7 +120,8 @@ class Http:
|
||||||
raise PayloadTooLarge("Request header exceeds the size limit")
|
raise PayloadTooLarge("Request header exceeds the size limit")
|
||||||
# Parse header content
|
# Parse header content
|
||||||
try:
|
try:
|
||||||
reqline, *raw_headers = buf[:pos].decode().split("\r\n")
|
raw_headers = buf[:pos].decode(errors="surrogateescape")
|
||||||
|
reqline, *raw_headers = raw_headers.split("\r\n")
|
||||||
method, self.url, protocol = reqline.split(" ")
|
method, self.url, protocol = reqline.split(" ")
|
||||||
if protocol == "HTTP/1.1":
|
if protocol == "HTTP/1.1":
|
||||||
self.keep_alive = True
|
self.keep_alive = True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user