HTTP/2 to origin: bodyless response with a header block over 4 KB fails to parse and is sent to the client as 502/500
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
Start with Http2Stream::send_headers and HttpSM::state_read_server_response_header, then follow HTTPHdr::parse_resp in HdrTSOnly.cc and MIMEScanner::get. Reproduce the bodyless HTTP/2 302 or 204 with an approximately 8.8 KB header block. Done means the large header parses across blocks and the client receives the origin response instead of a 502 or 500.
索引モデルが issue の本文から書いたものです。
説明
Summary
If an HTTP/2 origin sends a bodyless response (HEADERS with END_STREAM) whose header block is larger than one IOBuffer block (about 4 KB), ATS fails to parse it. The client gets a 502 or 500 instead of the origin's response. It mostly shows up on redirects and 204s that carry a large Content-Security-Policy or Set-Cookie.
Cause
Http2Stream::send_headers, which hands a received header to the HttpSM, prints the decoded response header into_receive_bufferone block at a time, adding a block wheneverprint()doesn't finish. A header of more than about 4 KB therefore spans several blocks, and a field can be split at a block boundary.- With
receive_end_streamset on an outbound stream, it then signalsVC_EVENT_EOS, not READ_READY or READ_COMPLETE. HttpSM::state_read_server_response_headerhandles that EOS by parsing witheof = true. It logsServer closed connection while reading response headerat this point, even though nothing closed.HTTPHdr::parse_resp(HdrTSOnly.cc) loops over the reader one block at a time and passes the sameeofflag for every block. When a field is cut at the end of the first block,MIMEScanner::gettreats it as the end of input and returnsParseResult::ERROR(unterminated field).- The result is
handle_server_setup_error, and the client gets an error. squid-style logs show the origin's real status (a 3xx or 204) next to the 5xx sent to the client, witho_bytesstopping just short of the field that crosses the 4 KB boundary.
Observed / reproduction
Reproduced on a 10.0.x build; HdrTSOnly.cc is identical on master.
- An HTTP/2 origin returns
302with no body and a header block of about 8.8 KB, including one longContent-Security-Policyfield. - A GET through ATS: the origin logs a 302, and the client gets a 502 every time, with
o_bytes=202and the request retried once (two attempts). - The same responses had no errors while that origin was reached over HTTP/1.1.
- In production traffic, one bodyless 3xx endpoint failed 150 of 150 requests.
Suggested fix
Either of these, or both:
- In
HTTPHdr::parse_resp, passeofonly for the last block, when there is no further block to read. - In
Http2Stream, write the whole decoded header into one block sized to fit it, so a header from an HTTP/2 frame is never split.
- 主要言語
- C++
- スター
- 2k
- フォーク
- 878
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 91
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/trafficserver のほかの issue
-
Bug HTTP Support
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
apache/trafficserver#13118 ·
メンテナーはふだん 2 日以内に返信
-
header_rewrite: rm-destination after set-destination URL crashes traffic_server対応中かも @moonchen が 6 日前に担当しました。 オープンBug Crash header_rewrite Plugins
apache/trafficserver#13800 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
apache/trafficserver#13798 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
apache/trafficserver#13784 ·
メンテナーはふだん 2 日以内に返信
-
Plugins
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/trafficserver#13774 ·
メンテナーはふだん 2 日以内に返信
apache/trafficserver の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
mudler/parakeet.cpp#99 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
raspberrypi/rpi-imager#1773 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
duckdb/duckdb-wasm#2267 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
AcademySoftwareFoundation/Imath#611 ·
メンテナーはふだん 1 日以内に返信
-
question
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100