Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

431 and 414 responses sent by hyper or h2 never reach the Service, so metrics middleware can't record them

未关闭
#4,249 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
rust

调研方向

Start by reading the hyper and h2 rejection paths named in the issue: proto/h1/role.rs and proto/streams/streams.rs. Trace how each path produces a 431 or 414 and consider where the server could expose the status to applications. Done means an application can observe these responses, including their status codes, for both HTTP/1.1 and HTTP/2.

由索引模型根据 Issue 内容生成。

描述

C-feature

Is your feature request related to a problem? Please describe.

When a request is too large for the server's limits, hyper (HTTP/1.1) or h2 (HTTP/2) writes the error response itself, and the request never reaches the Service. Middleware that records each request never sees these responses, for e.g. an OpenTelemetry histogram or a tracing span.

Here's what is observable today (hyper 1.12.0, h2 0.4.20):

Protocol Rejection Who responds What the application gets
HTTP/1.1 More than max_headers headers, or a head larger than max_buf_size hyper, 431 (Server::on_error in proto/h1/role.rs) The connection future returns Err, and is_parse_too_large() is true
HTTP/1.1 URI longer than 65,534 bytes hyper, 414 The same: is_parse_too_large() is true. Only the Display text, "URI too long", distinguishes it from the 431
HTTP/2 Header list larger than max_header_list_size h2, 431 followed by RST_STREAM (Streams::recv_headers in proto/streams/streams.rs) Nothing. The connection keeps serving other streams and ends with Ok(())

For HTTP/1.1 we can approximate a metric from the connection error. To tell a 414 from a 431, though, we have to match on the error's Display string, and we have none of the request's attributes, such as its method. For HTTP/2 there is nothing to hook into: no error, event or callback reaches hyper or the application when h2 answers with a 431.

Describe the solution you'd like

Some way for a server application to learn that hyper or h2 answered a request on its own, and with which status code - not entirely sure what this should look like yet.

Describe alternatives you've considered

Not aware of any other ways to solve this yet

主要语言
Rust
星标
16.4k
派生
1.8k
平均合并
1 天 13 小时
30 天内合并 PR
12

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperium/hyper 的其他 Issue

查看 hyperium/hyper 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。