This commit is contained in:
Rob Ede 2021-07-12 16:07:31 +01:00
parent d1efe02e92
commit 50738867af
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
5 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
[alias] [alias]
chk = "check --workspace --all-features --tests --examples --bins" chk = "check --workspace --all-features --tests --examples --bins"
lint = "clippy --workspace --tests --examples" lint = "clippy --workspace --all-features --tests --examples --bins"
ci-min = "hack check --workspace --no-default-features" ci-min = "hack check --workspace --no-default-features"
ci-min-test = "hack check --workspace --no-default-features --tests --examples" ci-min-test = "hack check --workspace --no-default-features --tests --examples"
ci-default = "check --workspace --bins --tests --examples" ci-default = "check --workspace --bins --tests --examples"

View File

@ -104,6 +104,8 @@ impl ServiceConfig {
} }
/// Returns the local address that this server is bound to. /// Returns the local address that this server is bound to.
///
/// Returns `None` for connections via UDS (Unix Domain Socket).
#[inline] #[inline]
pub fn local_addr(&self) -> Option<net::SocketAddr> { pub fn local_addr(&self) -> Option<net::SocketAddr> {
self.0.local_addr self.0.local_addr

View File

@ -65,10 +65,10 @@ fn first_header_value<'a>(req: &'a RequestHead, name: &'_ HeaderName) -> Option<
/// [rfc7239-63]: https://datatracker.ietf.org/doc/html/rfc7239#section-6.3 /// [rfc7239-63]: https://datatracker.ietf.org/doc/html/rfc7239#section-6.3
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct ConnectionInfo { pub struct ConnectionInfo {
scheme: String,
host: String, host: String,
realip_remote_addr: Option<String>, scheme: String,
remote_addr: Option<String>, remote_addr: Option<String>,
realip_remote_addr: Option<String>,
} }
impl ConnectionInfo { impl ConnectionInfo {
@ -145,9 +145,9 @@ impl ConnectionInfo {
let remote_addr = req.peer_addr.map(|addr| addr.to_string()); let remote_addr = req.peer_addr.map(|addr| addr.to_string());
ConnectionInfo { ConnectionInfo {
remote_addr,
scheme,
host, host,
scheme,
remote_addr,
realip_remote_addr, realip_remote_addr,
} }
} }

View File

@ -558,8 +558,8 @@ where
Ok(self) Ok(self)
} }
#[cfg(unix)]
/// Start listening for incoming unix domain connections. /// Start listening for incoming unix domain connections.
#[cfg(unix)]
pub fn bind_uds<A>(mut self, addr: A) -> io::Result<Self> pub fn bind_uds<A>(mut self, addr: A) -> io::Result<Self>
where where
A: AsRef<std::path::Path>, A: AsRef<std::path::Path>,
@ -598,7 +598,6 @@ where
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.client_disconnect(c.client_shutdown) .client_disconnect(c.client_shutdown)
.local_addr(socket_addr)
.finish(map_config(fac, move |_| config.clone())), .finish(map_config(fac, move |_| config.clone())),
) )
}, },

View File

@ -23,7 +23,7 @@ impl std::fmt::Display for MyError {
#[get("/test")] #[get("/test")]
async fn test() -> Result<actix_web::HttpResponse, actix_web::error::Error> { async fn test() -> Result<actix_web::HttpResponse, actix_web::error::Error> {
return Err(MyError.into()); Err(MyError.into())
} }
#[derive(Clone)] #[derive(Clone)]