Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#148 0 comentarios 0 reacciones 0 asignados Ver en GitHub

@ac1982 ya está trabajando en esto.

Desde el 15/10/2026.

  • #149 de @ac1982 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli, networking

Línea de trabajo

Empieza en la rama de URL de read_resource(), donde requests.get(path) va seguido directamente de response.text y del manejo de MIME. Ejecuta el script de reproducción con servidor local del issue para ver el código de salida 0 y el cuerpo del 404 renderizado. Está terminado cuando se informa un fallo HTTP con su estado y URL y el proceso termina con un código distinto de cero, o cuando los mantenedores confirman que los cuerpos de error deben seguir renderizándose con el estado pasado al llamador.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
3.8k
Forks
125
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Textualize/rich-cli

Todos los issues de Textualize/rich-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.