Skip to content

Commit

Permalink
Setup TLS adaptor when parsing an amqprs uri
Browse files Browse the repository at this point in the history
  • Loading branch information
tyilo committed Jan 15, 2024
1 parent 8207bed commit 16fb4da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion amqprs/src/api/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,9 @@ impl TryFrom<&str> for OpenConnectionArguments {
.unwrap_or("guest");

// Apply authority
let host = pu_authority.host().to_string();
let mut args = OpenConnectionArguments::new(
pu_authority.host().to_string().as_str(),
host.as_str(),
pu_authority.port().unwrap_or(default_port),
pu_authority_username,
pu_authority_password,
Expand Down Expand Up @@ -519,6 +520,13 @@ impl TryFrom<&str> for OpenConnectionArguments {
.unwrap_or(DEFAULT_HEARTBEAT);
args.heartbeat(heartbeat);

if scheme == AMQPS_SCHEME {
args.tls_adaptor(
TlsAdaptor::without_client_auth(None, host.to_string())
.map_err(|e| Error::UriError(format!("Error creating TLS adaptor: {e}")))?,
);
}

Ok(args)
}
}
Expand Down

0 comments on commit 16fb4da

Please sign in to comment.