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 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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
- 派生
- 881
- 平均合并
- 3 天 15 小时
- 30 天内合并 PR
- 94
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/trafficserver 的其他 Issue
-
Branch build clones: mirror stalls, clone timeout and controller memory可能已有人在做 @bryancall 于 6 天前认领。 未关闭CI
apache/trafficserver#13839 · 已指派 1 人 ·
维护者通常 2 天内回复
-
traffic_ctl: apply --error-level to config reload results可能已有人在做 @brbzull0 于 8 天前认领。 未关闭traffic_ctl
apache/trafficserver#13832 · 已指派 1 人 ·
维护者通常 2 天内回复
-
header_rewrite: rm-destination after set-destination URL crashes traffic_server可能已有人在做 @moonchen 于 15 天前认领。 未关闭Bug Crash header_rewrite Plugins
apache/trafficserver#13800 · 已指派 1 人 ·
维护者通常 2 天内回复
-
ssl_multicert: entries without dest_ip can override the default certificate可能已有人在做 @toxicteddy00077 于 1 天前认领。 未关闭Configuration SSL
难度 4/5 3-5 天 新手友好度 48/100
apache/trafficserver#13798 · 2 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
apache/trafficserver#13784 ·
维护者通常 2 天内回复
查看 apache/trafficserver 的全部 Issue
相似的 Issue
-
v9.6.0: CMake incorrectly enforces presence of libevdev可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
Rowan (2017) electron heating gives NaN for beta > beta_max; clip() then sets electrons to kel_min未关闭
难度 2/5 1-3 小时 新手友好度 72/100
parthenon-hpc-lab/kharma#213 · 1 条评论 ·
维护者通常 3 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
metasequoiaime/msime#9113 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
tone-3000/tone3000-plugin#257 · 1 条评论 ·
维护者通常 1 天内回复
-
Locked plugin flip-flops position on every refresh after being disabled可能已有人在做 @Illustar0 今天认领。 未关闭issue report
难度 2/5 1-3 小时 新手友好度 74/100
ModOrganizer2/modorganizer#2449 ·