[azure-core] _aiohttp_body_helper does not decompress Content-Encoding: br (Brotli)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
azure/core/utils/_pipeline_transport_rest_shared.py の _aiohttp_body_helper から始め、既存の gzip と deflate の処理を報告されている br パスと比較してください。Brotli の利用可能性がどのように宣言されているかを確認し、Brotli でエンコードされたレスポンスが response.text() の実行前に展開され、UnicodeDecodeError を発生させなくなっていることを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
Package: azure-core 1.41.0 (also affects azure-ai-agentserver-responses 1.0.0b7)
Description
_aiohttp_body_helper in azure.core.utils._pipeline_transport_rest_shared handles Content-Encoding: gzip and Content-Encoding: deflate, but does not handle Content-Encoding: br (Brotli). When an upstream service returns a Brotli-compressed response, the raw compressed bytes pass through to response.text(), which then raises UnicodeDecodeError.
Reproduction
This surfaces when using azure-ai-agentserver-responses as a Foundry Hosted Agent. The Foundry storage API (/storage/history/item_ids) returns Content-Encoding: br. The FoundryStorageProvider calls http_resp.text() which triggers the decode error.
The FoundryStorageProvider intentionally excludes ContentDecodePolicy from its pipeline (with a comment noting gzip crashes), so there is no other layer handling decompression.
Root Cause
In azure/core/utils/_pipeline_transport_rest_shared.py:
def _aiohttp_body_helper(response):
...
enc = response.headers.get("Content-Encoding")
if enc in ("gzip", "deflate"): # <- "br" not handled
...
return response._content # raw Brotli bytes pass through
Expected Behavior
Brotli responses should be decompressed transparently, matching how gzip/deflate are handled.
Suggested Fix
if enc in ("gzip", "deflate"):
...
elif enc == "br":
import brotli
response._content = brotli.decompress(response._content)
response._decompressed_content = True
return response._content
(The brotli package is already a common transitive dependency via aiohttp[speedups].)
Workaround
We monkey-patch _aiohttp_body_helper at import time to add Brotli support.
Environment
- Python 3.11
azure-core==1.41.0azure-ai-agentserver-responses==1.0.0b7- Platform: Azure AI Foundry Hosted Agent (Linux container)
- 主要言語
- Python
- スター
- 5.6k
- フォーク
- 3.4k
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 195
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/azure-sdk-for-python のほかの issue
-
Evaluation Service Attention
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Azure/azure-sdk-for-python#49190 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Update CODEOWNERSオープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
Azure/azure-sdk-for-python#49183 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Evaluation Service Attention
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Azure/azure-sdk-for-python#49153 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Search Service Attention
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Azure/azure-sdk-for-python#48555 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/azure-sdk-for-python#46697 ·
メンテナーはふだん 1 日以内に返信
Azure/azure-sdk-for-python の issue をすべて見る
似ている issue
-
docs pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pydantic/pydantic-ai#8863 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
run-llama/llama_index#23278 ·
メンテナーはふだん 2 日以内に返信
-
documentation from-review-extraction github-actions priority: low severity:nit
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
LearningCircuit/local-deep-research#6946 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
oracle/langchain-oracle#323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
tenstorrent/tt-metal#58057 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信