Add typed request-cookie parsing and Set-Cookie rendering
Los mantenedores suelen responder en 1 día
@lukewilliamboswell ya está trabajando en esto.
Desde el 31/7/2026.
- #207 de @lukewilliamboswell — abierto
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 42/100
Línea de trabajo
Comienza localizando el acceso al encabezado de solicitud utilizado por request.headers() y la representación del encabezado de respuesta para campos Set-Cookie independientes. Define el módulo Cookie puro en torno a las API parse_request y set_header ilustradas y, a continuación, añade las pruebas indicadas de análisis, validación, prefijo, SameSite, eliminación y encabezados duplicados. Se considera terminado cuando todos los criterios de aceptación se cumplen sin cambios en la ABI del host.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Add a pure Cookie module for:
- Parsing all
Cookierequest header fields while preserving duplicates. - Strictly rendering one
Set-Cookieheader from typed attributes. - Rendering a deletion cookie with matching
PathandDomain.
Illustrative API:
cookies = Cookie.parse_request(request.headers())?
header = Cookie.set_header({
name: "session",
value: session_id,
path: Present("/"),
domain: Absent,
max_age_seconds: Present(3600),
secure: True,
http_only: True,
same_site: Present(Lax),
})?
Why this belongs in the platform
Cookies are a conventional HTTP primitive needed by sessions, authentication, CSRF protection, and browser-facing applications. Hand-building cookie strings is error-prone because Set-Cookie has unusual header semantics and security-sensitive attribute combinations.
The current cookie specification permits multiple Set-Cookie fields and forbids combining them with commas. Servers must also tolerate multiple request Cookie fields, particularly because HTTP/2 and HTTP/3 intermediaries may split them.
Required contract
- Parse every case-insensitive
Cookieheader field. - Preserve cookie order and duplicate names as a
List, not a dictionary. - Treat names as case-sensitive.
- Provide an explicit
get_uniquehelper that reports duplicates instead of silently choosing one. - Validate names and values against the cookie grammar and reject control characters or header injection.
- Do not implicitly percent-encode, Base64-encode, or reinterpret values.
- Render each cookie as its own
Set-Cookieheader. - Support
Path,Domain,Max-Age,Secure,HttpOnly, andSameSite. - Reject
SameSite=NonewithoutSecure. - Enforce the
__Secure-and__Host-prefix requirements. - A deletion helper must accept the original
PathandDomainscope and emit an empty value withMax-Age=0. - Header resource use remains bounded by the server's existing header limits.
Expires, Partitioned, cookie priority, and browser cookie-jar behavior can be follow-ups. Max-Age provides the initial persistent-expiry and deletion contract without introducing a general calendar API.
Tests
Include multiple header fields, duplicate names, case-sensitive names, whitespace, empty values, invalid bytes, commas, CR/LF injection, prefix rules, SameSite=None, and multiple independent Set-Cookie response headers.
Non-goals
- A browser cookie jar with domain/path matching
- Signed or encrypted cookies
- Sessions or authentication
- Public-suffix-list processing
- Automatic mutation of every request or response
- Selecting one duplicate cookie based on serialization order
Acceptance criteria
- Applications can parse all request cookie fields without losing duplicates.
- Applications can render security-sensitive cookie attributes through typed values.
- Multiple response cookies remain multiple
Set-Cookiefields. - Invalid values and unsafe attribute combinations produce typed errors.
- The implementation is pure Roc and requires no host ABI change.
References
- Lenguaje dominante
- HTML
- Estrellas
- 110
- Forks
- 25
- Merge medio
- 18 h 28 min
- PR fusionados (30 d)
- 16
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 roc-lang/basic-webserver
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
roc-lang/basic-webserver#277 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
roc-lang/basic-webserver#274 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
roc-lang/basic-webserver#273 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
roc-lang/basic-webserver#272 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
roc-lang/basic-webserver#265 ·
Los mantenedores suelen responder en 1 día
Todos los issues de roc-lang/basic-webserver
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OHDSI/Data2Evidence#3815 ·
Los mantenedores suelen responder en 3 días
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
redhat-developer/rhdh-plugin-export-overlays#4995 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
fidelity
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsPosiblemente ocupada @huanghaoyuanhhy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
zilliztech/milvus-backup#1418 ·
Los mantenedores suelen responder en 1 día
-
[Bug] download repeatedly fetches unchanged gzip responses due to compressed/decoded size mismatchPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
stanfordnlp/dspy#11000 ·
Los mantenedores suelen responder en 1 día