Skip to content

Commit

Permalink
Fix HTTP2/1.1 translated messages dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha committed Jun 6, 2024
1 parent bae7524 commit 0c8caf5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/2497.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix HTTP2/1.1 translated messages dropping
11 changes: 7 additions & 4 deletions mirrord/intproxy/src/proxies/incoming/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ impl HttpSender {
.map_err(Into::into)
}
Self::V2(sender) => {
let mut req = req.into_hyper();
// fixes https://github.com/metalbear-co/mirrord/issues/2497
// inspired by https://github.com/linkerd/linkerd2-proxy/blob/c5d9f1c1e7b7dddd9d75c0d1a0dca68188f38f34/linkerd/proxy/http/src/h2.rs#L175
if req.uri().authority().is_none() {
*req.version_mut() = hyper::http::Version::HTTP_11;
}
// Solves a "connection was not ready" client error.
// https://rust-lang.github.io/wg-async/vision/submitted_stories/status_quo/barbara_tries_unix_socket.html#the-single-magical-line
sender.ready().await?;
sender
.send_request(req.into_hyper())
.await
.map_err(Into::into)
sender.send_request(req).await.map_err(Into::into)
}
}
}
Expand Down

0 comments on commit 0c8caf5

Please sign in to comment.