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

sdk: Check if server name points to homeserver during discovery #3218

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

zecakeh
Copy link
Collaborator

@zecakeh zecakeh commented Mar 15, 2024

The small first commit reintroduces sanitize_server_name in the public API. In Fractal, we use it to validate the string in the input before allowing the user to trigger the discovery.

The main commit changes a bit the discovery process: before, server names like example.org would only be checked for the presence of a well-known, and only URLs like https://example.org would be checked as a homeserver. Now, providing example.org will also check if https://example.org is the URL of a homeserver.

Sadly I don't think it's possible to add tests for it as it would require to have a homeserver accessible via HTTPS.

…scovery

Before, only URLs like `https://example.org` would be checked as a homeserver.
Providing `example.org` will check if `https://example.org` is the URL of a homeserver.

Signed-off-by: Kévin Commaille <[email protected]>
@zecakeh zecakeh requested a review from a team as a code owner March 15, 2024 11:51
@zecakeh zecakeh requested review from bnjbvr and removed request for a team March 15, 2024 11:51
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.67%. Comparing base (a328d87) to head (3f3b443).
Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3218   +/-   ##
=======================================
  Coverage   83.67%   83.67%           
=======================================
  Files         236      236           
  Lines       24442    24444    +2     
=======================================
+ Hits        20452    20454    +2     
  Misses       3990     3990           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks! A proposal to avoid just a bit of code duplication, not sure if it's worth it, let me know your thoughts!

crates/matrix-sdk/src/client/builder.rs Outdated Show resolved Hide resolved
crates/matrix-sdk/src/client/builder.rs Outdated Show resolved Hide resolved
Signed-off-by: Kévin Commaille <[email protected]>
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks!

@bnjbvr bnjbvr enabled auto-merge (squash) March 15, 2024 14:01
@bnjbvr bnjbvr merged commit 876d323 into matrix-org:main Mar 15, 2024
34 checks passed
@zecakeh zecakeh deleted the discovery branch March 17, 2024 12:10
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