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

HTTP error responses are rendered as successful input with exit status 0

オープン 初心者向け
#148 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@ac1982 がすでに取り組んでいます。

2026年10月15日 から。

  • #149 @ac1982 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
cli, networking

調査の方向性

read_resource() の URL 分岐から始めてください。そこでは requests.get(path) の直後に response.text と MIME の処理が続きます。issue にあるローカルサーバーの再現スクリプトを実行し、終了コード 0 と 404 のボディが表示されることを確認してください。完了条件は、HTTP エラーがステータスと URL 付きで報告され、プロセスがゼロ以外の終了コードで終了すること、または、エラーのボディは呼び出し元に渡すステータスとともに引き続き表示すべきだとメンテナが確認することです。

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

説明

A URL returning HTTP 404 is rendered as if it were a successfully loaded document, and the CLI exits with status 0. A script using Rich CLI cannot distinguish a missing resource from a successful read.

Environment
  • rich-cli distribution 1.8.1, default-branch commit 46f4d2469097be395558768714a5f07ebccf1412
  • Python 3.10.12, Linux x86_64
  • Rich 12.6.0, Click 8.5.0
Reproduction

Save this as http_status_repro.py and run it. It serves one local 404 response, so it does not depend on an external website.

import http.server
import subprocess
import threading

class Handler(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(404)
        self.send_header('Content-Type', 'text/plain')
        self.end_headers()
        self.wfile.write(b'NOT_FOUND_DEMO\n')

    def log_message(self, *args):
        pass

server = http.server.ThreadingHTTPServer(('127.0.0.1', 0), Handler)
threading.Thread(target=server.serve_forever, daemon=True).start()
try:
    result = subprocess.run(
        ['rich', f'http://127.0.0.1:{server.server_port}/missing.txt', '--syntax'],
        capture_output=True, text=True,
    )
    print('exit:', result.returncode)
    print('stdout:', repr(result.stdout))
    print('stderr:', repr(result.stderr))
finally:
    server.shutdown()
Actual output
exit: 0
stdout: 'NOT_FOUND_DEMO\n\n'
stderr: ''
Expected behavior

A failed HTTP read should report the status/URL and exit nonzero, rather than treat the server's error body as the requested document. If displaying error bodies is intended, the failure status should still reach the caller.

Cause

In the URL branch of read_resource(), requests.get(path) is followed immediately by response.text and MIME handling. There is no response-status check, so an HTTP failure reaches the normal render path.

The complete local-server reproduction above was run against the revision and environment listed here. No claim is made about remote authentication or network timeouts.

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

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

Textualize/rich-cli のほかの issue

Textualize/rich-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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