fix(handlers): handle non integer content-length
This commit is contained in:
+4
-1
@@ -252,7 +252,10 @@ class BaseHandler(abc.ABC, http.server.BaseHTTPRequestHandler):
|
||||
return self.__in_size
|
||||
|
||||
def _get_length(self) -> int:
|
||||
return max(0, int(self._get_header("Content-Length", "0")))
|
||||
try:
|
||||
return max(0, int(self._get_header("Content-Length", "0")))
|
||||
except ValueError:
|
||||
return 0
|
||||
|
||||
def _get_header(self, key: str, default_value: str = "") -> str:
|
||||
if self._has_header(key):
|
||||
|
||||
Reference in New Issue
Block a user