-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unix domain socket support? #538
Comments
Does ureq support unix domain sockets? |
Not currently, no. |
With |
What would the API look like? |
Some initial ideas: Add a transport type to the agent:
Allow setting a raw transport stream (eg. maybe anything that implements Read and Write) to read and write from in the agent:
Embed the socket in the protocol string somehow (note: there is no standard for this yet - see whatwg/url#577 ):
|
Adding to the mix of ideas, allow for http+unix://%2Ftmp%2Fapi.sock/service?query=1
|
Closing since we're moving to ureq 3.x. In 3.x the transport is completely replaceable. This should be very solvable. |
I gave this a try with Even if diff --git a/src/proxy.rs b/src/proxy.rs
index 7694713..8b771c2 100644
--- a/src/proxy.rs
+++ b/src/proxy.rs
@@ -23,6 +23,7 @@ pub(crate) enum Proto {
Socks4,
Socks4A,
Socks5,
+ Unix,
}
impl Proto {
@@ -31,6 +32,7 @@ impl Proto {
Proto::Http => 80,
Proto::Https => 443,
Proto::Socks4 | Proto::Socks4A | Proto::Socks5 => 1080,
+ Proto::Unix => u16::MAX,
}
}
@@ -279,6 +281,7 @@ impl TryFrom<&str> for Proto {
"socks4a" => Ok(Proto::Socks4A),
"socks" => Ok(Proto::Socks5),
"socks5" => Ok(Proto::Socks5),
+ "http+unix" => Ok(Proto::Unix),
_ => Err(Error::InvalidProxyUrl),
}
}
@@ -302,6 +305,7 @@ impl fmt::Display for Proto {
Proto::Socks4 => write!(f, "SOCKS4"),
Proto::Socks4A => write!(f, "SOCKS4a"),
Proto::Socks5 => write!(f, "SOCKS5"),
+ Proto::Unix => write!(f, "UNIX"),
}
}
} Can this be reopened? I'll see about updating that PR to |
To be clear, the above doesn't stop one implementing a Connector/Transport/Resolver that contains the socket path and just ignores the host part of the URI. But it would be convenient if ureq could make |
Don't find in the docs about unix domain socket support. Can provider an example for this?
The text was updated successfully, but these errors were encountered: