Skip to content

Commit

Permalink
Add logs to particular bad test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Feb 22, 2024
1 parent 9f3214b commit 5bb71ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bootstrap/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ async fn tunnel(upgraded: Upgraded, addr: SocketAddr) -> std::io::Result<()> {
/// This prevents the relay from being used as an arbitrary proxy
/// to any host on the internet.
fn find_allowable_gateway<B>(req: &Request<B>, gateway_origin: &Uri) -> Option<SocketAddr> {
dbg!("req.uri().authority()", req.uri().authority());
dbg!("gateway_origin.authority()", gateway_origin.authority());
if req.uri().authority() != gateway_origin.authority() {
return None;
}
Expand Down
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,20 @@ pub(crate) fn uri_to_addr(uri: &Uri) -> Option<SocketAddr> {
let parts: Vec<&str> = authority.split(':').collect();
let host = parts.first()?;
let port = parts.get(1).and_then(|p| p.parse::<u16>().ok());

// dbg statements
dbg!("host", host);
dbg!("port", port);
dbg!("authority", authority);
let default_port = match uri.scheme_str() {
Some("https") => 443,
_ => 80, // Default to 80 if it's not https or if the scheme is not specified
};

let addr_str = format!("{}:{}", host, port.unwrap_or(default_port));
addr_str.to_socket_addrs().ok()?.next()
dbg!("addr_str", &addr_str);
let sock = addr_str.to_socket_addrs().ok()?.next();
dbg!("sock", &sock);
sock
}

pub(crate) fn empty() -> BoxBody<Bytes, hyper::Error> {
Expand Down

0 comments on commit 5bb71ed

Please sign in to comment.