aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy
diff options
context:
space:
mode:
Diffstat (limited to 'pingora-proxy')
-rw-r--r--pingora-proxy/src/proxy_h1.rs7
-rw-r--r--pingora-proxy/src/proxy_h2.rs14
-rw-r--r--pingora-proxy/src/proxy_trait.rs3
-rw-r--r--pingora-proxy/src/subrequest.rs3
-rw-r--r--pingora-proxy/tests/utils/server_utils.rs7
5 files changed, 21 insertions, 13 deletions
diff --git a/pingora-proxy/src/proxy_h1.rs b/pingora-proxy/src/proxy_h1.rs
index 1dbb561..15ce038 100644
--- a/pingora-proxy/src/proxy_h1.rs
+++ b/pingora-proxy/src/proxy_h1.rs
@@ -116,13 +116,18 @@ impl<SV> HttpProxy<SV> {
SV: ProxyHttp + Send + Sync,
SV::CTX: Send + Sync,
{
+ #[cfg(windows)]
+ let raw = client_session.id() as std::os::windows::io::RawSocket;
+ #[cfg(unix)]
+ let raw = client_session.id();
+
if let Err(e) = self
.inner
.connected_to_upstream(
session,
reused,
peer,
- client_session.id(),
+ raw,
Some(client_session.digest()),
ctx,
)
diff --git a/pingora-proxy/src/proxy_h2.rs b/pingora-proxy/src/proxy_h2.rs
index 0750160..f133c2f 100644
--- a/pingora-proxy/src/proxy_h2.rs
+++ b/pingora-proxy/src/proxy_h2.rs
@@ -193,16 +193,14 @@ impl<SV> HttpProxy<SV> {
SV: ProxyHttp + Send + Sync,
SV::CTX: Send + Sync,
{
+ #[cfg(windows)]
+ let raw = client_session.fd() as std::os::windows::io::RawSocket;
+ #[cfg(unix)]
+ let raw = client_session.fd();
+
if let Err(e) = self
.inner
- .connected_to_upstream(
- session,
- reused,
- peer,
- client_session.fd(),
- client_session.digest(),
- ctx,
- )
+ .connected_to_upstream(session, reused, peer, raw, client_session.digest(), ctx)
.await
{
return (false, Some(e));
diff --git a/pingora-proxy/src/proxy_trait.rs b/pingora-proxy/src/proxy_trait.rs
index 029ea58..4f3f627 100644
--- a/pingora-proxy/src/proxy_trait.rs
+++ b/pingora-proxy/src/proxy_trait.rs
@@ -425,7 +425,8 @@ pub trait ProxyHttp {
_session: &mut Session,
_reused: bool,
_peer: &HttpPeer,
- _fd: std::os::unix::io::RawFd,
+ #[cfg(unix)] _fd: std::os::unix::io::RawFd,
+ #[cfg(windows)] _sock: std::os::windows::io::RawSocket,
_digest: Option<&Digest>,
_ctx: &mut Self::CTX,
) -> Result<()>
diff --git a/pingora-proxy/src/subrequest.rs b/pingora-proxy/src/subrequest.rs
index e75dcc6..f9367b7 100644
--- a/pingora-proxy/src/subrequest.rs
+++ b/pingora-proxy/src/subrequest.rs
@@ -19,6 +19,7 @@ use pingora_cache::lock::WritePermit;
use pingora_core::protocols::raw_connect::ProxyDigest;
use pingora_core::protocols::{
GetProxyDigest, GetSocketDigest, GetTimingDigest, SocketDigest, Ssl, TimingDigest, UniqueID,
+ UniqueIDType,
};
use std::io::Cursor;
use std::sync::Arc;
@@ -68,7 +69,7 @@ impl AsyncWrite for DummyIO {
}
impl UniqueID for DummyIO {
- fn id(&self) -> i32 {
+ fn id(&self) -> UniqueIDType {
0 // placeholder
}
}
diff --git a/pingora-proxy/tests/utils/server_utils.rs b/pingora-proxy/tests/utils/server_utils.rs
index f90a27e..885fcb1 100644
--- a/pingora-proxy/tests/utils/server_utils.rs
+++ b/pingora-proxy/tests/utils/server_utils.rs
@@ -192,7 +192,8 @@ impl ProxyHttp for ExampleProxyHttps {
_http_session: &mut Session,
reused: bool,
_peer: &HttpPeer,
- _fd: std::os::unix::io::RawFd,
+ #[cfg(unix)] _fd: std::os::unix::io::RawFd,
+ #[cfg(windows)] _sock: std::os::windows::io::RawSocket,
digest: Option<&Digest>,
ctx: &mut CTX,
) -> Result<()> {
@@ -311,7 +312,8 @@ impl ProxyHttp for ExampleProxyHttp {
_http_session: &mut Session,
reused: bool,
_peer: &HttpPeer,
- _fd: std::os::unix::io::RawFd,
+ #[cfg(unix)] _fd: std::os::unix::io::RawFd,
+ #[cfg(windows)] _sock: std::os::windows::io::RawSocket,
digest: Option<&Digest>,
ctx: &mut CTX,
) -> Result<()> {
@@ -544,6 +546,7 @@ fn test_main() {
let mut proxy_service_http =
pingora_proxy::http_proxy_service(&my_server.configuration, ExampleProxyHttp {});
proxy_service_http.add_tcp("0.0.0.0:6147");
+ #[cfg(unix)]
proxy_service_http.add_uds("/tmp/pingora_proxy.sock", None);
let mut proxy_service_h2c =