fix(handlers): handle non integer content-length
Docker CI / docker-build (push) Has been cancelled
Python Lint CI / ty (push) Has been cancelled
Python Lint CI / ruff (push) Has been cancelled
Python Lint CI / ruff-format-check (push) Has been cancelled
Python Test CI / coverage (push) Has been cancelled

This commit is contained in:
2026-06-02 23:40:12 +02:00
parent 2bc2593bc9
commit d84c5911b0
+4 -1
View File
@@ -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):