Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

aiohttp.FileResponse responses replace Pulp's cache validators

Aperta
#8,293 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
619
Fork
176
Merge medio
16h 49m
PR unite (30g)
126

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pulp/pulpcore

Tutte le issue di pulp/pulpcore

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.