Skip to content

RUST-2001 Allow SRV hostnames with less than three parts #1211

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

Merged
merged 6 commits into from
Oct 4, 2024

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Oct 1, 2024

RUST-2001

The actual changed logic is in LookupHosts::validate (which used to be in SrvResolver::get_srv_hosts), and is the conditional bit near the top checking the length of original_hostname_parts. The rest of this is refactoring to make the new logic testable.

if host_list.len() != 1 {
return Err(ErrorKind::InvalidArgument {
message: "exactly one host must be specified with 'mongodb+srv'".into(),
let host_info = if !srv {
Copy link
Contributor Author

@abr-egn abr-egn Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't directly related to the change, but when I was reading through to understand the original code I had a hard time skimming this section. This changes it to put the success cases up front and have the error cases nicely enumerated.

@abr-egn abr-egn marked this pull request as ready for review October 2, 2024 17:56
@abr-egn abr-egn requested a review from isabelatkinson October 2, 2024 17:56
@abr-egn abr-egn merged commit 7a408c3 into mongodb:main Oct 4, 2024
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants