Skip to content

Commit

Permalink
wasi-http: add the port to authority when opening a TCP connection
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed May 21, 2024
1 parent cc93e8f commit ede4253
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/wasi-http/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ pub async fn default_send_request_handler(
between_bytes_timeout,
}: OutgoingRequestConfig,
) -> Result<IncomingResponse, types::ErrorCode> {
let Some(authority) = request.uri().authority().map(ToString::to_string) else {
let port = if use_tls { 443 } else { 80 };
let Some(authority) = request.uri().authority().map(|s| format!("{s}:{port}")) else {
return Err(types::ErrorCode::HttpRequestUriInvalid);
};
let tcp_stream = timeout(connect_timeout, TcpStream::connect(&authority))
Expand Down

0 comments on commit ede4253

Please sign in to comment.