Skip to content

Commit 86eabba

Browse files
committed
Add measurement header injection
1 parent be7581a commit 86eabba

4 files changed

Lines changed: 220 additions & 49 deletions

File tree

Cargo.lock

Lines changed: 44 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ repository = "https://github.com/flashbots/attested-tls-proxy"
1111
keywords = ["attested-TLS", "CVM", "TDX"]
1212

1313
[dependencies]
14-
attested-tls = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-crate" }
15-
nested-tls = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-crate" }
16-
attestation = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-crate" }
14+
attested-tls = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-expose-cert-verifier" }
15+
nested-tls = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-expose-cert-verifier" }
16+
attestation = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-expose-cert-verifier" }
1717
tokio = { version = "1.50.0", features = ["full"] }
1818
tokio-rustls = { version = "0.26.4", default-features = false }
1919
x509-parser = { version = "0.18.0", features = ["verify"] }
@@ -47,7 +47,7 @@ pin-project-lite = "0.2.16"
4747
[dev-dependencies]
4848
tempfile = "3.23.0"
4949
tdx-quote = { version = "0.0.5", features = ["mock"] }
50-
attestation = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-crate", features = ["mock"] }
50+
attestation = { git = "https://github.com/flashbots/attested-tls", branch = "peg/attested-tls-expose-cert-verifier", features = ["mock"] }
5151
tokio = { version = "1.48.0", features = ["full"] }
5252
jsonrpsee = { version = "0.26.0", features = ["server"] }
5353

src/http_version.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! HTTP Version support and negotiation
22
use hyper::Response;
33
use hyper_util::rt::TokioIo;
4+
use bytes::Bytes;
45
use std::pin::Pin;
56
use std::task::{Context, Poll};
67

@@ -55,15 +56,18 @@ impl HttpVersion {
5556
}
5657
}
5758

58-
type Http1Sender = hyper::client::conn::http1::SendRequest<hyper::body::Incoming>;
59-
type Http2Sender = hyper::client::conn::http2::SendRequest<hyper::body::Incoming>;
59+
type Http1Sender = hyper::client::conn::http1::SendRequest<http_body_util::Full<Bytes>>;
60+
type Http2Sender = hyper::client::conn::http2::SendRequest<http_body_util::Full<Bytes>>;
6061

6162
type Http1Connection =
62-
hyper::client::conn::http1::Connection<TokioIo<ProxyClientTlsStream>, hyper::body::Incoming>;
63+
hyper::client::conn::http1::Connection<
64+
TokioIo<ProxyClientTlsStream>,
65+
http_body_util::Full<Bytes>,
66+
>;
6367

6468
type Http2Connection = hyper::client::conn::http2::Connection<
6569
TokioIo<ProxyClientTlsStream>,
66-
hyper::body::Incoming,
70+
http_body_util::Full<Bytes>,
6771
crate::TokioExecutor,
6872
>;
6973

@@ -88,8 +92,9 @@ impl From<Http2Sender> for HttpSender {
8892
impl HttpSender {
8993
pub async fn send_request(
9094
&mut self,
91-
request: http::Request<hyper::body::Incoming>,
95+
request: http::Request<Bytes>,
9296
) -> Result<Response<hyper::body::Incoming>, hyper::Error> {
97+
let request = request.map(http_body_util::Full::new);
9398
match self {
9499
Self::Http1(sender) => sender.send_request(request).await,
95100
Self::Http2(sender) => sender.send_request(request).await,

0 commit comments

Comments
 (0)