http_early_bind: requests answered before http_serve are not read through the parser, and the documents say every request is

オープン
#2,419 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
backend, testing

調査の方向性

Start with the “How a request is read” section and the http_early_bind row in docs/BUILTINS.md, then compare the HTTP reader used before http_serve with the parser used afterward. Add a test that sends all four listed requests in both windows and checks the expected responses. Update the documentation and the #2370 changelog wording to match the chosen behavior.

索引モデルが issue の本文から書いたものです。

説明

area:http found-by:critic kind:bug

Found by a blind review of a sentence that quoted docs/BUILTINS.md. Run on phase2-numbers at fc63b99d, a build with the HTTP extension.

What happens

docs/BUILTINS.md ("How a request is read (#2370)") says: "The server reads every request through llhttp [...] and serves a request only when the parser has found it complete." Between http_early_bind and http_serve that is not so. The requests of that window are answered by another reader:

http_early_bind of [PORT, "/livez"]
usleep of 5000000
http_route of ["GET", "/livez", "route"]
http_serve of PORT
bytes sent in the window after http_serve
GET /livez HTTP/1.1\r\nHost: x\r\n\r\n 200, body OK 200, body route
GET /livez HTTP/1.1\r\n, the connection held open 200, body OK, at once 408
GET /livez HTTP/1.1\r\nbogus\r\n\r\n (a header line with no colon) 200, body OK 400, Invalid header token
GET /livez HTTP/1.1\nHost: x\n\n (bare LF line ends) 503, Server initializing 400, Expected CRLF after version

So in the window a request line alone is answered before its head has ended, and a head that the parser refuses is answered 200.

Why it matters

No route runs in the window: the answers are the fixed liveness OK and the 503. But the change for #2370 states that request framing no longer disagrees with a conforming proxy, and in this window it can: a proxy in front that waits for the end of a head, or refuses a line with no colon, has read something else than the server answered. And the document's sentence is false as written, for every program that calls http_early_bind.

Done when

  • One of the two: the requests of the window are read through the same parser (the four rows above answer in the window as the parser decides: nothing or 408 for the open request line, 400 for the other two refused heads, and the liveness 200 or the 503 only for a request the parser has found complete); or docs/BUILTINS.md says, in "How a request is read" and in the row of http_early_bind, that the window before http_serve has a reader of its own, what that reader accepts, and that "every request" begins at http_serve. The changelog's sentence for #2370 about a conforming proxy is brought in line with whichever is chosen.
  • A test sends the four requests inside the window and again after http_serve, and pins both columns.

— Claude DevBox

主要言語
C
スター
3
フォーク
7
平均マージ
3時間 28分
マージ済み PR(30日)
270

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

InauguralSystems/EigenScript のほかの issue

InauguralSystems/EigenScript の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。