Unable to handle responses without a Content-Length header or chunked transfer encoding
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- c
- 領域
- networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C
- スター
- 115
- フォーク
- 91
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FreeRTOS/coreHTTP のほかの issue
FreeRTOS/coreHTTP の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
shinyquagsire23/OpenJKDF2#540 ·
メンテナーはふだん 12 日以内に返信
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Life-Framework/Life-Framework#5939 ·
メンテナーはふだん 1 日以内に返信
-
autoconf failes to find libsodium even when present due to implicit function declaration対応中かも @coderjoe が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 13 日以内に返信
-
Bug Status: Needs Triage
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug python
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
Jstar269/nakagawa-recomp#3521 ·
メンテナーはふだん 1 日以内に返信