aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy/src
diff options
context:
space:
mode:
authorYuchen Wu <[email protected]>2024-09-26 16:40:31 -0700
committerYuchen Wu <[email protected]>2024-10-11 15:40:59 -0700
commit4aadba12727afe6178f3b9fc2a3cad2223ac7b2e (patch)
tree48c28248062b02a9803a38887253edfe4679a764 /pingora-proxy/src
parent289687928a0bea04df31f76db783548b62cd8af6 (diff)
downloadpingora-4aadba12727afe6178f3b9fc2a3cad2223ac7b2e.tar.gz
pingora-4aadba12727afe6178f3b9fc2a3cad2223ac7b2e.zip
Windows support
Co-authored-by: Fredrik Enestad <[email protected]>
Diffstat (limited to 'pingora-proxy/src')
-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
4 files changed, 16 insertions, 11 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
}
}