process_response marks the session accessed, so every response gets Vary: Cookie
Nadie ha tomado este issue todavía.
- #481 de @r3wretrhy — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
Start by reproducing the issue with Quart's test client and inspect Quart.process_response, then compare the websocket counterpart where session_ = ctx.session is also used. Update both paths so untouched sessions do not produce Vary: Cookie while session-using requests retain the header; verify both behaviors with regression tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Quart.process_response reads the session through the ctx.session property:
session_ = ctx.session
if not self.session_interface.is_null_session(session_):
await self.ensure_async(self.session_interface.save_session)(
self, session_, response
)
That property sets session.accessed = True, so SecureCookieSessionInterface.save_session then adds Vary: Cookie to every response. This includes views that never touch the session, and static files. As a result, no shared cache or CDN will store them.
Minimal reproduction (Quart 0.23.1, also current main):
import asyncio
from quart import Quart
app = Quart(__name__)
app.secret_key = "not-secret"
@app.get("/")
async def index() -> str:
return "this view never touches the session"
async def main() -> None:
response = await app.test_client().get("/")
print("Vary:", response.headers.get("Vary"))
asyncio.run(main())
Output: Vary: Cookie. The equivalent Flask 3.1.3 app prints Vary: None, because Flask's process_response reads the private attribute instead:
if not self.session_interface.is_null_session(ctx._session):
self.session_interface.save_session(self, ctx._session, response)
Proposed fix: do the same in Quart.process_response (and in the websocket counterpart, which has the same session_ = ctx.session line), so only a request that actually used the session varies on the cookie. I'm happy to open a PR.
- Lenguaje dominante
- Python
- Estrellas
- 3.7k
- Forks
- 209
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 pallets/quart
-
Changelog link is brokenAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
`abort` typing doesn't accept Response as a valid parameterPosiblemente ocupada @touilleMan la tomó hace 1448 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
-
Installing asgi_app middleware as documented results in type errorsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Allow max content length to be modified on a per-request basisQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de pallets/quart
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
KalicoCrew/kalico#1012 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
esphome/esphome.io#7657 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
VNG-Realisatie/gemma-zaken#2658 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
comp/gateway comp/plugins duplicate P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NousResearch/hermes-agent#137019 ·
Los mantenedores suelen responder en 1 día