diff --git a/stapler/handlers.py b/stapler/handlers.py index 667975d..5ef5046 100644 --- a/stapler/handlers.py +++ b/stapler/handlers.py @@ -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):