aiohttp.FileResponse responses replace Pulp's cache validators
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
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
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.
- Lenguaje dominante
- Python
- Estrellas
- 619
- Forks
- 176
- Merge medio
- 16 h 49 min
- PR fusionados (30 d)
- 126
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pulp/pulpcore
-
Content cache ignores the query string, so one path serves the response cached for another queryAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Reclaim Space Server ErrorAbiertoIssue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
pulp/pulpcore#5802 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
-
Issue
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Issue
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de pulp/pulpcore
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
aws-samples/sample-per-model-bedrock#639 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
awslabs/visual-asset-management-system#937 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
project-codeflare/codeflare-sdk#1195 ·
Los mantenedores suelen responder en 1 día
-
Bump numpy dependencyAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
pandas-dev/pandas-stubs#2051 ·
Los mantenedores suelen responder en 1 día