dfd
This commit is contained in:
@@ -147,7 +147,11 @@ class HydrusNetwork:
|
||||
|
||||
file_size = file_path.stat().st_size
|
||||
headers["Content-Type"] = spec.content_type or "application/octet-stream"
|
||||
headers["Content-Length"] = str(file_size)
|
||||
# Do not set Content-Length when streaming an iterator body.
|
||||
# If the file size changes between stat() and read() (or the source is truncated),
|
||||
# h11 will raise: "Too little data for declared Content-Length".
|
||||
# Let httpx choose chunked transfer encoding for safety.
|
||||
headers.pop("Content-Length", None)
|
||||
|
||||
logger.debug(f"{self._log_prefix()} Uploading file {file_path.name} ({file_size} bytes)")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user