Add Option<&'static [u8]> method for header names
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Comienza localizando la representación del nombre de cabecera y su método as_bytes existente; después, inspecciona cómo se identifican los nombres de cabecera estándar. Añade el método propuesto para que los nombres ASCII estándar puedan exponer bytes estáticos, mientras que los demás nombres devuelvan None, y añade pruebas que cubran ambos casos. En el issue no se mencionan archivos ni rutas de pruebas específicos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
This enhancement focuses on improving the usability of the http crate when integrating Rust HTTP libraries with other VM engines, such as V8 (specifically for, but not limited to Deno). The goal is to provide embedding users with a specific method that allows extracting a static 7-bit string from a well-known ASCII header name. By treating header strings as interned strings in scripting engines [1] [2], we can effectively reduce garbage collection pressure, leading to enhanced performance and efficiency.
To achieve this, we propose introducing an Option<&'static [u8]> method for header names. This approach offers a more efficient means of passing header names across embedding boundaries. When working with static ASCII header names, this method allows direct access to the header name bytes across embedding boundaries, without the need for additional memory allocation or garbage collection overhead.
This may also be useful for Python embedders [2], as (I believe) the CPython engine allows creation of strings from const 1-byte buffers.
Alternatives
While we do have an as_bytes method on a header name, this does not tell us the provenance of those bytes, and whether the header is a StandardHeader. We cannot use these as "externally interned" strings in an embedding context because they may be allocated.
The hash function of the header could be used allow us to map between standard headers and interned strings in the embedded engine, but this requires an additional string comparison operation.
References
[1] V8's NewExternalOneByte method:
[2] Python's PyUnicode_FromKindAndData method (which I believe will avoid copies where necessary):
https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_FromKindAndData
- Lenguaje dominante
- Rust
- Estrellas
- 1.4k
- Forks
- 382
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 hyperium/http
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
Todos los issues de hyperium/http
Issues similares
-
C-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rust-lang/rust-analyzer#23501 ·
Los mantenedores suelen responder en 1 día
-
Streamable HTTP client: a 401 or 403 with a JSON-RPC error body and no WWW-Authenticate loses its HTTP statusPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug P2 ready for work T-security T-transport
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modelcontextprotocol/rust-sdk#1339 ·
Los mantenedores suelen responder en 3 días
-
scripts/gen-gallery.py:118: a ready session now reports in_progress, so SESSION_READY_OLD can goAbiertonightly-audit
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
antithesishq/snouty#396 ·
Los mantenedores suelen responder en 1 día
-
French BIP39 wordlist starts with a UTF-8 BOM, so generated French mnemonics carry U+FEFF and derive a non-canonical seedPosiblemente ocupada @Kshot3000 la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
ergoplatform/sigma-rust#976 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día