Skip to content

Commit 6640508

Browse files
committed
fix: avoid decoding demo blob compression twice; release 0.46.1
1 parent c7c6499 commit 6640508

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎packages/vgi-fixtures/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# and the conformance suite import it by its normal `vgi._test_fixtures` path.
99
[project]
1010
name = "vgi-fixtures"
11-
version = "0.46.0"
11+
version = "0.46.1"
1212
description = "Example/test VGI worker modules and entry points (not for production use)"
1313
readme = "README.md"
1414
# Local copy of the repo-root LICENSE (kept in sync): the build can't reach

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vgi-python"
3-
version = "0.46.0"
3+
version = "0.46.1"
44
description = "Vector Gateway Interface - Connect DuckDB to external programs via Apache Arrow"
55
readme = "README.md"
66
keywords = [

‎tests/test_http_demo_storage.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ def test_demo_output_offload_large_response(compression: str, expected_extension
294294
assert source.decode().endswith(expected_extension)
295295
assert fetch_ms is not None
296296

297+
# Advertising both headers causes clients that decode standard HTTP
298+
# compression to try to decompress the same external result twice.
299+
blob_headers = httpx2.head(source.decode(), timeout=30.0).headers
300+
assert "X-VGI-Content-Encoding" not in blob_headers
301+
assert blob_headers.get("Content-Encoding") == (None if compression == "none" else compression)
302+
297303

298304
@pytest.mark.parametrize("compression", ["none", "zstd", "gzip"])
299305
def test_demo_input_upload_url_then_exchange(compression: str) -> None:

‎uv.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vgi/http/demo_storage.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ def on_get(self, req: Any, resp: Any, blob_id: str) -> None: # noqa: D102
118118
resp.content_type = "application/octet-stream"
119119
resp.set_header("Accept-Ranges", "none")
120120
if content_encoding:
121+
# HTTP clients decode this standard header automatically. Sending
122+
# the custom VGI header too makes clients try to decode it again.
121123
resp.set_header("Content-Encoding", content_encoding)
122-
resp.set_header("X-VGI-Content-Encoding", content_encoding)
123124

124125
def on_head(self, req: Any, resp: Any, blob_id: str) -> None: # noqa: D102
125126
# Mirror on_get headers (Content-Length/-Type/-Encoding) without a body.
@@ -137,7 +138,6 @@ def on_head(self, req: Any, resp: Any, blob_id: str) -> None: # noqa: D102
137138
resp.set_header("Accept-Ranges", "none")
138139
if content_encoding:
139140
resp.set_header("Content-Encoding", content_encoding)
140-
resp.set_header("X-VGI-Content-Encoding", content_encoding)
141141

142142
def on_put(self, req: Any, resp: Any, blob_id: str) -> None: # noqa: D102
143143
# vgi_rpc's _CompressionMiddleware drains ``req.bounded_stream`` when

0 commit comments

Comments
 (0)