Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

🐛 Bug Report: http --download misinterprets Content-Length when Content-Encoding: gzip is set

オープン
#1,642 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
cli, networking

調査の方向性

まず、提供された http --download GET コマンドで問題を再現し、HTTPie のダウンロード処理を調べます。Content-Length と Content-Encoding: gzip がどのように解釈されるかを確認し、その後、圧縮されたペイロードが不完全なダウンロードのエラーなしに保存され、既存のダウンロード動作が維持されることを検証します。

索引モデルが issue の本文から書いたものです。

説明

bug new

🐛 Bug Report: http --download misinterprets Content-Length when Content-Encoding: gzip is set

Summary

When using httpie with --download to retrieve a file with Content-Encoding: gzip, the tool reports an "Incomplete download" even though the Content-Length is correctly set to the size of the compressed payload.

This behavior contradicts the HTTP/1.1 spec, which states that Content-Length must reflect the encoded (compressed) size when Content-Encoding is used.

Steps to Reproduce
  1. Serve a GZIP-compressed JSON file with these headers:
Content-Type: application/json
Content-Encoding: gzip
Content-Disposition: attachment; filename="data.json.gz"
Content-Length: 5084527  # actual size of compressed content
  1. Use HTTPie to download the file:
http --download GET http://localhost:3000/download
  1. Observe this error:
Incomplete download: size=5084527; downloaded=42846965

Note: The server is not using chunked encoding and Content-Length is accurate.

Expected Behavior

httpie should:

  • Trust Content-Length as the size of the compressed body.
  • Simply save the file without decompressing or misinterpreting the length.

This is what browsers, curl, and wget all do correctly.

Actual Behavior

httpie seems to assume Content-Length is the uncompressed size, leading it to flag the download as incomplete when it receives more data than expected.

Environment
  • HTTPie version: httpie 3.2.4
  • OS: macOS / Linux (reproduced in both)
  • Server: Custom Go server (Fiber), but same issue with static gzipped files
References
Debug Info
http get "localhost:3000/metrics/admin/00:11:00:00:22:00/20250101T000000Z/download?format=json" Authorization:"Bearer ey....." --download --debug
HTTPie 3.2.4
Requests 2.32.4
Pygments 2.19.1
Python 3.13.5 (main, Jun 11 2025, 15:36:57) [Clang 17.0.0 (clang-1700.0.13.3)]
/opt/homebrew/Cellar/httpie/3.2.4_3/libexec/bin/python
Darwin 24.5.0

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x10665cd60>,
 'args': Namespace(),
 'as_silent': <function Environment.as_silent at 0x10665cc20>,
 'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/Users/alex/.config/httpie'),
 'devnull': <property object at 0x106642110>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x10665ccc0>,
 'program_name': 'http',
 'quiet': 0,
 'rich_console': <functools.cached_property object at 0x105a0e690>,
 'rich_error_console': <functools.cached_property object at 0x106630c00>,
 'show_displays': True,
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': True}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>,
          <class 'httpie.plugins.builtin.BearerAuthPlugin'>],
 'converters': [],
 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
                <class 'httpie.output.formatters.json.JSONFormatter'>,
                <class 'httpie.output.formatters.xml.XMLFormatter'>,
                <class 'httpie.output.formatters.colors.ColorFormatter'>]}>

>>> requests.request(**{'auth': None,
 'data': RequestJSONDataDict(),
 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.4', 'Authorization': b'Bearer eyJh...', 'Accept-Encoding': b'identity')>,
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x106a7d030>,
 'url': 'http://localhost:3000/metrics/admin/00:11:00:00:22:00/20250101T000000Z/download?format=json'})

HTTP/1.1 200 OK
Content-Disposition: attachment; filename="001100002200-20250101T000000Z.alog.json.gzip"
Content-Encoding: gzip
Content-Length: 5084527
Content-Type: application/json
Date: Thu, 10 Jul 2025 16:22:21 GMT

Downloading to 001100002200-20250101T000000Z.alog.json.gzip
Done. 42.8 MB in 00:0.07174 (597.2 MB/s)

http: error: Incomplete download: size=5084527; downloaded=42846965

主要言語
Python
スター
38.6k
フォーク
4k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

httpie/cli のほかの issue

httpie/cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。