From 87fcb7c8b0730fe486d9d4eea76e72fea4bf6cc1 Mon Sep 17 00:00:00 2001 From: Shay Date: Thu, 23 Dec 2021 02:12:25 -0800 Subject: [PATCH] Clarify that `base_url` in client `well_known` may or may not include trailing slash (#3562) Fixes #3465. The change adds a line explicitly warning developers that the base_url of client well_known may or may not include a trailing slash and to be prepared to handle both cases. --- changelogs/client_server/newsfragments/3562.clarification | 1 + content/client-server-api/_index.md | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/client_server/newsfragments/3562.clarification diff --git a/changelogs/client_server/newsfragments/3562.clarification b/changelogs/client_server/newsfragments/3562.clarification new file mode 100644 index 00000000..f7ac9b77 --- /dev/null +++ b/changelogs/client_server/newsfragments/3562.clarification @@ -0,0 +1 @@ +Clarify that `base_url` in client `well_known` may or may not include trailing slash. \ No newline at end of file diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index 675ac594..d87777e2 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -285,10 +285,10 @@ specify parameter values. The flow for this method is as follows: 1. If the content cannot be parsed, then `FAIL_PROMPT`. 4. Extract the `base_url` value from the `m.homeserver` property. This value is to be used as the base URL of the homeserver. - 1. If this value is not provided, then `FAIL_PROMPT`. + 1. If this value is not provided, then `FAIL_PROMPT`. 5. Validate the homeserver base URL: - 1. Parse it as a URL. If it is not a URL, then `FAIL_ERROR`. - 2. Clients SHOULD validate that the URL points to a valid + 1. Parse it as a URL. If it is not a URL, then `FAIL_ERROR`. + 2. Clients SHOULD validate that the URL points to a valid homeserver before accepting it by connecting to the [`/_matrix/client/versions`](/client-server-api/#get_matrixclientversions) endpoint, ensuring that it does not return an error, and parsing and validating that the @@ -297,6 +297,8 @@ specify parameter values. The flow for this method is as follows: done as a simple check against configuration errors, in order to ensure that the discovered address points to a valid homeserver. + 3. It is important to note that the `base_url` value might include + a trailing `/`. Consumers should be prepared to handle both cases. 6. If the `m.identity_server` property is present, extract the `base_url` value for use as the base URL of the identity server. Validation for this URL is done as in the step above, but using