Unable to handle responses without a Content-Length header or chunked transfer encoding
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- c
- Domaine
- networking
Piste de recherche
Read the response parsing path in parseHttpResponse() and httpParserOnBodyCallback(), along with the TransportRecv_t contract. Reproduce the case with an HTTP/1.1 response lacking both Content-Length and chunked encoding, where the server closes the connection after sending the body. Done means the client recognizes the completed body at EOF and the change handles transport closure without misclassifying it as a timeout.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I am using coreHTTP v3.0.0 to communicate with an HTTP/1.1 server that does not include a Content-Length header nor uses chunked transfer encoding. In this case, the server tells the client that the response body has been fully read by closing the underlying TCP connection. Using BSD sockets, this would mean that select() informs that data can be read from the socket, but the subsequent call to recv() returns no data.
Unfortunately, coreHTTP is not able to handle this behaviour as it is indistinguishable from a read timeout. I can think of two fixes that could be applied to solve this issue, but both would require modifying TransportRecv_t in some way:
- Add a new return value to
TransportRecv_tthat would be set if the transport connection has been closed. This solution is clearer, but would change the signature ofTransportRecv_t. - Use a specific
TransportRecv_treturn value to represent a closed connection. This keeps the API but may cause issues if the transport implementation uses this return value.
In addition, either parseHttpResponse() or httpParserOnBodyCallback() should be modified to call to llhttp_finish() if required. This change may look something like this:
/* Finish parsing if the connection has been closed by the server after
* the response has been sent. This is only relevant if the response
* does not include a Content-Length header nor uses chunked transfer
* encoding. */
if( llhttp_message_needs_eof( &( pParsingContext->llhttpParser ) ) && ( isClosed == 1U ) )
{
( void ) llhttp_finish( &( pParsingContext->llhttpParser ) );
}
Would it be possible to fix this issue without the TransportRecv_t modifications? I have implemented one of the possible fixes in my fork of coreHTTP, in case you want to have a look.
- Langage dominant
- C
- Étoiles
- 115
- Forks
- 91
- Merge moyen
- 2 j 7 h
- PR mergées (30 j)
- 2
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de FreeRTOS/coreHTTP
-
coreHTTP State Access AuditOuvertehelp wanted
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Toutes les issues de FreeRTOS/coreHTTP
Issues similaires
-
RecompLauncher supportOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
shinyquagsire23/OpenJKDF2#540 ·
Les mainteneurs répondent en général sous 12 jours
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Life-Framework/Life-Framework#5939 ·
Les mainteneurs répondent en général sous 1 jour
-
autoconf failes to find libsodium even when present due to implicit function declarationPeut-être pris @coderjoe l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 13 jours
-
SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecationOuverteBug Status: Needs Triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement_package: a site operand of another JSON type raises TypeError, not a named refusalOuvertebug python
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
Jstar269/nakagawa-recomp#3521 ·
Les mainteneurs répondent en général sous 1 jour