[PR #391] [MERGED] Fix HTTP/2 requests failing with duplicate Content-Length #313

Closed
opened 2026-03-22 21:16:30 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/391
Author: @gschier
Created: 2/11/2026
Status: Merged
Merged: 2/12/2026
Merged by: @gschier

Base: mainHead: fix-http2


📝 Commits (5)

  • e6dbdc1 Fix HTTP/2 requests failing with duplicate Content-Length
  • 0fd643a Remove manual h2 repro test
  • ac9c078 Add Vite dev server for HTTP/2 reproduction testing
  • b8befcf Remove h2-repro test server
  • bb43c33 Replace unsafe impl Sync with Mutex for SizedBody

📊 Changes

5 files changed (+91 additions, -51 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates-tauri/yaak-app/src/http_request.rs (+2 -2)
📝 crates/yaak-http/Cargo.toml (+1 -0)
📝 crates/yaak-http/src/sender.rs (+57 -4)
📝 crates/yaak-http/src/types.rs (+30 -45)

📄 Description

  • Fixed HTTP/2 requests failing with PROTOCOL_ERROR when connecting to HTTP/2-only servers (e.g., Vite dev server with HTTPS)
  • Root cause: Yaak explicitly added Content-Length as an HTTP header, but hyper also sets it internally for HTTP/2 DATA frames, causing a duplicate that HTTP/2 servers reject
  • Instead of setting Content-Length as an explicit header, the content length is now carried through SendableBody::Stream { content_length } and reported via http_body::Body::size_hint(), letting hyper handle it correctly for both HTTP/1.1 and HTTP/2

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/391 **Author:** [@gschier](https://github.com/gschier) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `fix-http2` --- ### 📝 Commits (5) - [`e6dbdc1`](https://github.com/mountain-loop/yaak/commit/e6dbdc1db5acfe0e814d44820642a1b9f08be7bc) Fix HTTP/2 requests failing with duplicate Content-Length - [`0fd643a`](https://github.com/mountain-loop/yaak/commit/0fd643ac68d7608f38f2749c305c4ef1f9e566d5) Remove manual h2 repro test - [`ac9c078`](https://github.com/mountain-loop/yaak/commit/ac9c07813aaaf1ad260dbbf46f66b7fcfeb82dad) Add Vite dev server for HTTP/2 reproduction testing - [`b8befcf`](https://github.com/mountain-loop/yaak/commit/b8befcfbc694206ab2a3479bac6dad3a54be7d04) Remove h2-repro test server - [`bb43c33`](https://github.com/mountain-loop/yaak/commit/bb43c33bc12c56efcd05a6d6eb5b500a4f7dad77) Replace unsafe impl Sync with Mutex for SizedBody ### 📊 Changes **5 files changed** (+91 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates-tauri/yaak-app/src/http_request.rs` (+2 -2) 📝 `crates/yaak-http/Cargo.toml` (+1 -0) 📝 `crates/yaak-http/src/sender.rs` (+57 -4) 📝 `crates/yaak-http/src/types.rs` (+30 -45) </details> ### 📄 Description - Fixed HTTP/2 requests failing with `PROTOCOL_ERROR` when connecting to HTTP/2-only servers (e.g., Vite dev server with HTTPS) - Root cause: Yaak explicitly added `Content-Length` as an HTTP header, but hyper also sets it internally for HTTP/2 DATA frames, causing a duplicate that HTTP/2 servers reject - Instead of setting `Content-Length` as an explicit header, the content length is now carried through `SendableBody::Stream { content_length }` and reported via `http_body::Body::size_hint()`, letting hyper handle it correctly for both HTTP/1.1 and HTTP/2 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-22 21:16:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#313