-
Notifications
You must be signed in to change notification settings - Fork 731
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
Well known lookups should be to port 443 only. #6095
Conversation
In the context of matrix IDs, this removes the leading @name: leaving the hostname or hostname and port.
I'm not 100% sure this is the right change, but given the reading of the spec I believe so. However, the other clients also handle well-known the old way. iOS does this here: https://github.com/vector-im/element-ios/blob/develop/RiotSwiftUI/Modules/Authentication/Common/Service/MatrixSDK/AuthenticationService.swift#L230 (which is to make the request to the homeserver url without removing the port) There is also a commented out section here, which talks about doing a lookup based on the matrix ID: (I'm unable to test actual behaviour due to lack of iOS device) Element Web makes a https request with the specified port: eg entering your username as |
Hydrogen is making a request to eg https://hydrogen.element.io/null/_matrix/client/r0/login when i give my homeserver as eg "matrix.org:8080", so disreguarding that as it doesn't appear to be implemented yet. |
If we don't want to go this way, we could perhaps add a much shorter timeout on the well-known lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Matrix SDKIntegration Tests Results:
|
Type of change
Content
Per https://spec.matrix.org/unstable/client-server-api/#well-known-uri, step two:
The hostname should not include a port, and should not query https://hostname:port/.well-known/matrix/client.
We achieve this by removing the port from the server_name before making a well-known lookup.
Additionally, I have renamed "getDomain" to "getServerName" as that is closer to the meaning of the second half of the matrix ID (after the first colon)
Motivation and context
There were originally issues with unit tests running against servers on non-standard ports (eg http://localhost:8080). These would then attempt to lookup well-known data by accessing https://localhost:8080/ (NB: https). These would fail because the port was listening for plain http.
This attempts to fix those tests by following the well-known resolution steps fully, and removing the port. This causes lookups against eg https://localhost:443/ instead, which in the test cases, is generally not responding with valid data.
This is also closer to the specification.
Tests
Tests continue to work; login has become faster for hosts over http because the timeout attempting to connect has been removed.
However, we should be aware that this is a change in behaviour and may possibly cause some servers with an interesting configuration to have issues, eg if your server_name is
target-domain.com:8443
and you host your well-known athttps://target-domain.com:8443/
nothttps://target-domain.com:443/
.Tested devices
Checklist