rename function and fix type

This commit is contained in:
Peter Bieringer
2025-12-13 08:06:58 +01:00
parent c73a53d815
commit cf98ef0b4a
2 changed files with 4 additions and 4 deletions

View File

@@ -98,13 +98,13 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
self._mask_passwords = configuration.get("logging", "mask_passwords")
self._max_content_length = configuration.get("server", "max_content_length")
self._max_resource_size = configuration.get("server", "max_resource_size")
logger.info("max_content_length to: %d bytes (%sbytes)", self._max_content_length, utils.format_int(self._max_content_length, binary=True))
logger.info("max_content_length set to: %d bytes (%sbytes)", self._max_content_length, utils.format_unit(self._max_content_length, binary=True))
if (self._max_resource_size > (self._max_content_length * 0.8)):
max_resource_size_limited = int(self._max_content_length * 0.8)
logger.warning("max_resource_size capped to: %d bytes (%sbytes) (from %d to 80%% of max_content_length)", max_resource_size_limited, utils.format_int(max_resource_size_limited, binary=True), self._max_resource_size)
logger.warning("max_resource_size set to: %d bytes (%sbytes) (capped from %d to 80%% of max_content_length)", max_resource_size_limited, utils.format_unit(max_resource_size_limited, binary=True), self._max_resource_size)
self._max_resource_size = max_resource_size_limited
else:
logger.info("max_resource_size set to: %d bytes (%sbytes)", self._max_resource_size, utils.format_int(self._max_resource_size, binary=True))
logger.info("max_resource_size set to: %d bytes (%sbytes)", self._max_resource_size, utils.format_unit(self._max_resource_size, binary=True))
self._bad_put_request_content = configuration.get("logging", "bad_put_request_content")
logger.info("log bad put request content: %s", self._bad_put_request_content)
self._request_header_on_debug = configuration.get("logging", "request_header_on_debug")

View File

@@ -303,7 +303,7 @@ def format_ut(unixtime: int) -> str:
return r
def format_int(value: int, binary: bool = False) -> str:
def format_unit(value: float, binary: bool = False) -> str:
if binary:
if value > UNIT_G:
value = value / UNIT_G