Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

/client/r0/publicRooms is case sensitive #6750

Closed
aaronraimist opened this issue Jan 20, 2020 · 3 comments
Closed

/client/r0/publicRooms is case sensitive #6750

aaronraimist opened this issue Jan 20, 2020 · 3 comments

Comments

@aaronraimist
Copy link
Contributor

aaronraimist commented Jan 20, 2020

Description

Searching the room directory is case sensitive. If you search for KDE.org in the room directory but the actual server_name is kde.org then the following error message is logged and the room directory isn't found.

Jan 20 18:15:29 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:29,958 - synapse.access.http.8008 - 302 - INFO - OPTIONS-1158828 - 176.113.73.10 - 8008 - {None} Processed request: 0.001sec/0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 2B 200 "OPTIONS /_matrix/client/r0/publicRooms?server=KDE.org HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15" [0 dbevts]
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,127 - synapse.access.http.8008 - 233 - INFO - POST-1158829 - 176.113.73.10 - 8008 - Received request: POST /_matrix/client/r0/publicRooms?server=KDE.org
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,128 - synapse.util.caches.response_cache - 148 - INFO - POST-1158829 - [remote_room_list]: no cached result for [('KDE.org', 20, None, False, None)], calculating new one
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,129 - synapse.http.matrixfederationclient - 408 - INFO - POST-1158829 - {GET-O-458120} [KDE.org] Sending request: GET matrix://KDE.org/_matrix/federation/v1/publicRooms?include_all_networks=false&limit=20; timeout 60.000000s
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,474 - synapse.http.federation.well_known_resolver - 178 - INFO - POST-1158829 - Response from .well-known: {'m.server': 'kde.modular.im:443'}
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,555 - synapse.http.matrixfederationclient - 440 - INFO - POST-1158829 - {GET-O-458120} [KDE.org] Got response headers: 401 Unauthorized
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,555 - synapse.http.matrixfederationclient - 522 - WARNING - POST-1158829 - {GET-O-458120} [KDE.org] Request failed: GET matrix://KDE.org/_matrix/federation/v1/publicRooms?include_all_networks=false&limit=20: HttpResponseException("401: b'Unauthorized'")
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: 2020-01-20 18:15:30,556 - synapse.http.server - 109 - ERROR - POST-1158829 - Failed handle request via 'PublicRoomListRestServlet': <XForwardedForRequest at 0x7f5e1606d9d0 method='POST' uri='/_matrix/client/r0/publicRooms?server=KDE.org' clientproto='HTTP/1.1' site=8008>
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: Traceback (most recent call last):
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/http/server.py", line 77, in wrapped_request_handler
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     await h(self, request)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/http/server.py", line 326, in _async_render
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     callback_return = await callback_return
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/rest/client/v1/room.py", line 408, in on_POST
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     third_party_instance_id=third_party_instance_id,
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     result = result.throwExceptionIntoGenerator(g)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     return g.throw(self.type, self.value, self.tb)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/handlers/room_list.py", line 391, in get_remote_public_room_list
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     third_party_instance_id=third_party_instance_id,
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     result = result.throwExceptionIntoGenerator(g)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     return g.throw(self.type, self.value, self.tb)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/federation/transport/client.py", line 364, in get_public_rooms
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     destination=remote_server, path=path, args=args, ignore_backoff=True
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     result = result.throwExceptionIntoGenerator(g)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     return g.throw(self.type, self.value, self.tb)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 776, in get_json
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     timeout=timeout,
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     result = result.throwExceptionIntoGenerator(g)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     return g.throw(self.type, self.value, self.tb)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 246, in _send_request_with_optional_trailing_slash
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     response = yield self._send_request(request, **send_request_args)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     result = g.send(result)
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:   File "/usr/local/lib/python3.7/site-packages/synapse/http/matrixfederationclient.py", line 477, in _send_request
Jan 20 18:15:30 ubuntu matrix-synapse[20428]:     raise e
Jan 20 18:15:30 ubuntu matrix-synapse[20428]: synapse.api.errors.HttpResponseException: 401: b'Unauthorized'

Steps to reproduce

  • Use Riot to search the room directory of KDE.org (rather than kde.org)

Version information

  • Homeserver: raim.ist
  • Version:
{
    "python_version": "3.7.6",
    "server_version": "1.8.0"
}
  • Install method: matrix-docker-ansible-deploy

  • Platform: Ubuntu 18.04

@aaronraimist
Copy link
Contributor Author

Hmm the spec says this is supposed to happen? I thought domain names were case insensitive?

Server names must be treated case-sensitively: in other words, @user:matrix.org is a different person from @user:MATRIX.ORG.

@neilisfragile
Copy link
Contributor

The reason is that they appear in event state keys, which are case sensitive. So this is counter intuitive but correct.

Closing since there is nothing that can be done until server names are no longer part included in state keys.

@richvdh
Copy link
Member

richvdh commented Feb 10, 2020

we could do a case-insensitive search of the room directory though?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants