aiohttp.FileResponse responses replace Pulp's cache validators
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
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
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.
- https://github.com/aio-libs/aiohttp/blob/f17c631bddcfd4ec712342db28f1d3381a3fec71/aiohttp/web_fileresponse.py#L400
- https://github.com/aio-libs/aiohttp/blob/f17c631bddcfd4ec712342db28f1d3381a3fec71/aiohttp/web_response.py#L363-L372
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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pulp/pulpcore
-
Content cache ignores the query string, so one path serves the response cached for another queryAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Reclaim Space Server ErrorApertaIssue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
pulp/pulpcore#5802 · 10 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
-
Issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pulp/pulpcore
Issue simili
-
Admin member of a research group cannot see the HX2 allocation until they've been added to itAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
developmentseed/titiler-cmr#278 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni