Content-Length invalid for unicode text
- Langage dominant
- TypeScript
- Étoiles
- 1.2k
- Forks
- 242
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When generating a http request string, the content-length seems to be calculated using the number of codepoints instead of bytes.
This was generated using insomnia, which uses httpsnippet:
```
POST /api/v1/test HTTP/1.1
Content-Type: text/plain
User-Agent: insomnia/2023.5.8
Host: localhost:5003
Content-Length: 3
äöü
```
This is what insomnia actually sends when executing the request (visualized using nc -l localhost 5003)
```
$ nc -l localhost 5003
POST /api/v1/test HTTP/1.1
Host: localhost:5003
Content-Type: text/plain
User-Agent: insomnia/2023.5.8
Accept: */*
Content-Length: 6
äöü
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start by tracing the code that generates the HTTP request string and calculates Content-Length, then check how Unicode text is encoded. Add a regression test using äöü and verify that the generated length matches the UTF-8 byte count.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100