-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Call appservices on modern paths, falling back to legacy paths. #15317
Changes from all commits
369f70c
5a96a3c
87b4f16
17bfb21
2dd943b
53757d6
03027ab
9e5a0c7
87d5576
bdd57dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix a long-standing bug that Synpase only used the [legacy appservice routes](https://spec.matrix.org/v1.6/application-service-api/#legacy-routes). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -982,20 +982,21 @@ def is_unknown_endpoint( | |
| """ | ||
| if synapse_error is None: | ||
| synapse_error = e.to_synapse_error() | ||
| # MSC3743 specifies that servers should return a 404 or 405 with an errcode | ||
|
|
||
| # Matrix v1.6 specifies that servers should return a 404 or 405 with an errcode | ||
| # of M_UNRECOGNIZED when they receive a request to an unknown endpoint or | ||
| # to an unknown method, respectively. | ||
| # | ||
| # Older versions of servers don't properly handle this. This needs to be | ||
| # rather specific as some endpoints truly do return 404 errors. | ||
| # Older versions of servers don't return proper errors, so be graceful. But, | ||
| # also handle that some endpoints truly do return 404 errors. | ||
| return ( | ||
| # 404 is an unknown endpoint, 405 is a known endpoint, but unknown method. | ||
| (e.code == 404 or e.code == 405) | ||
| and ( | ||
| # Older Dendrites returned a text body or empty body. | ||
| # Older Conduit returned an empty body. | ||
| # Consider empty body or non-JSON bodies to be unrecognised (matches | ||
| # older Dendrites & Conduits). | ||
| not e.response | ||
| or e.response == b"404 page not found" | ||
| or not e.response.startswith(b"{") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the fence about whether we should just decode the JSON or whether this sniffing is fine. But in any case I think this might need an
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We do attempt to decode it in the |
||
| # The proper response JSON with M_UNRECOGNIZED errcode. | ||
| or synapse_error.errcode == Codes.UNRECOGNIZED | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.