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

HTTP CONNECT proxy tunnel has lax response parsing and loses early data

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
networking

调研方向

从 src/client/legacy/connect/proxy/tunnel.rs 中的 CONNECT 响应处理开始,然后阅读 src/common/rewind.rs 中的私有 Rewind 结构,以了解缓冲上下文。检查 handshake API,并确定应如何表示严格的响应解析和保留的早期数据;当畸形响应被拒绝,且隧道建立后目标服务器的数据仍被保留时,即表示完成。

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

描述

A-client C-bug E-pr-welcome K-hyper-util
Version

hyper-util 0.1.20

Platform

Linux 6.18.14

Summary

While evaluating hyper-util's client::legacy::connect::proxy::tunnel for use with gRPC routing over HTTP CONNECT proxies, I identified two limitations in the current handshake implementation.

1. Lax Response Parsing

It heuristically matches the start and end of the expected response, potentially accepting malformed responses.

This can be fixed by using httparse to properly parse the response.

2. No Buffering for Early Data

It assumes the read buffer contains no data from the target server immediately after the proxy's response. This assumption holds for protocols where the client always speaks first (e.g., TLS) after the tunnel is established. However, since gRPC implementations must work with any security protocol, they must handle cases where the server sends data immediately.

Fixing this would require an API change, as the returned I/O stream would need to incorporate a buffer for the peeked data, similar to the private Rewind struct.

Although the handshaking code is simple enough to be re-implemented in gRPC, I wanted to check if these fixes can be upstreamed to allow us to use hyper-util.

Code Sample

Expected Behavior
  • The proxy response must be correctly parsed.
  • The data from the target server must be retained.
Actual Behavior
  • A malformed proxy response may be accepted
  • The data from the target server may be lost.
Additional Context

No response

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

贡献指南

打开贡献指南

从这里开始

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

hyperium/hyper 的其他 Issue

查看 hyperium/hyper 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

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