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

aiohttp.FileResponse responses replace Pulp's cache validators

Abierto
#8,293 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Start by reading aiohttp's FileResponse header handling at the linked lines in aiohttp/web_fileresponse.py and aiohttp/web_response.py, then run the reproducer in the issue against the current behavior. The issue is done when the response preserves the supplied Last-Modified and ETag values and the regression test passes.

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

Descripción

Issue Triage-Needed

Pulp calculates Last-Modified from publication or repository metadata and ETag from the artifact SHA-256. On aiohttp.web.FileResponse, these are replaced with filesystem stats. For last-modified, it rounds a fractional modified time up to the next whole second.

This caused some flaky tests on CI, but more importatnly, it prevents pulp from responding with the correct last-modified, which is not the filesystem stat last modified, but when the content was added to the distribution.

This test reproduces the header replacement. It fails with the current FileResponse behavior:

import os
from email.utils import formatdate

import pytest
from aiohttp import web


@pytest.mark.asyncio
async def test_file_response_preserves_pulp_validators(aiohttp_client, tmp_path):
    path = tmp_path / "artifact"
    path.write_bytes(b"content")
    mtime_ns = 1_700_000_000_250_000_000
    os.utime(path, ns=(mtime_ns, mtime_ns))
    expected = {
        "Last-Modified": formatdate(1_699_999_999, usegmt=True),
        "ETag": '"artifact-sha256"',
    }

    async def serve(request):
        return web.FileResponse(path, headers=expected)

    app = web.Application()
    app.router.add_get("/", serve)
    response = await (await aiohttp_client(app)).get("/")

    assert {name: response.headers[name] for name in expected} == expected

Aided by GPT-6.

Lenguaje dominante
Python
Estrellas
619
Forks
176
Merge medio
16 h 49 min
PR fusionados (30 d)
126

Preparar el entorno

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 pulp/pulpcore

Todos los issues de pulp/pulpcore

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.