mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
keepalive debug
This commit is contained in:
parent
f11550538f
commit
c09288880b
|
@ -42,11 +42,18 @@ class HttpCli(object):
|
|||
|
||||
def run(self):
|
||||
"""returns true if connection can be reused"""
|
||||
self.keepalive = False
|
||||
self.headers = {}
|
||||
try:
|
||||
headerlines = read_header(self.sr)
|
||||
if not headerlines:
|
||||
return False
|
||||
|
||||
if not headerlines[0]:
|
||||
# seen after login with IE6.0.2900.5512.xpsp.080413-2111 (xp-sp3)
|
||||
self.log("\033[1;31mBUG: trailing newline from previous request\033[0m")
|
||||
headerlines.pop(0)
|
||||
|
||||
try:
|
||||
self.mode, self.req, _ = headerlines[0].split(" ")
|
||||
except:
|
||||
|
@ -56,7 +63,6 @@ class HttpCli(object):
|
|||
self.loud_reply(str(ex), status=ex.code)
|
||||
return False
|
||||
|
||||
self.headers = {}
|
||||
for header_line in headerlines[1:]:
|
||||
k, v = header_line.split(":", 1)
|
||||
self.headers[k.lower()] = v.strip()
|
||||
|
|
|
@ -325,6 +325,9 @@ def read_header(sr):
|
|||
|
||||
ret += buf
|
||||
|
||||
if len(ret) > 1024 * 64:
|
||||
raise Pebkac(400, "header 2big")
|
||||
|
||||
return ret[:-4].decode("utf-8", "surrogateescape").split("\r\n")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue