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