Skip to content
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

Finish TODO: HttpPeer::new_uds error #217

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pingora-core/src/upstreams/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//! Defines where to connect to and how to connect to a remote server

use ahash::AHasher;
use pingora_error::{ErrorType, OrErr, Result};
use std::collections::BTreeMap;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::hash::{Hash, Hasher};
Expand Down Expand Up @@ -407,9 +408,12 @@ impl HttpPeer {
}

/// Create a new [`HttpPeer`] with the given path to Unix domain socket and TLS settings.
pub fn new_uds(path: &str, tls: bool, sni: String) -> Self {
let addr = SocketAddr::Unix(UnixSocketAddr::from_pathname(Path::new(path)).unwrap()); //TODO: handle error
Self::new_from_sockaddr(addr, tls, sni)
pub fn new_uds(path: &str, tls: bool, sni: String) -> Result<Self> {
let addr = SocketAddr::Unix(
UnixSocketAddr::from_pathname(Path::new(path))
.or_err(ErrorType::InternalError, "invalid path")?,
);
Ok(Self::new_from_sockaddr(addr, tls, sni))
}

/// Create a new [`HttpPeer`] that uses a proxy to connect to the upstream IP and port
Expand Down
2 changes: 1 addition & 1 deletion pingora-proxy/tests/utils/server_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl ProxyHttp for ExampleProxyHttp {
"/tmp/nginx-test.sock",
false,
"".to_string(),
)));
)?));
}
let port = req
.headers
Expand Down