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

Provisioner small fixes #397

Merged
merged 5 commits into from
Apr 7, 2022
Merged

Provisioner small fixes #397

merged 5 commits into from
Apr 7, 2022

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Apr 5, 2022

A few things I found annoying when working on the hookshot widget stuff:

  • addRoute had only a few supported methods, this has now been increased to all supported methods by Router
  • The openID handling code wasn't correctly concatenating the homeserver base URL and the request path.
  • The request logging felt too noisy at info, so I reduced it down to debug. I'm still 50/50 on that change.
  • The matrix-host-resolver would die if the well known Content-Type was not application/json. While we could be strict, it appears Synapse is not and we should attempt to parse strings as JSON.

@Half-Shot Half-Shot requested a review from a team April 5, 2022 08:46
constructor(
private expressReq: {body: Body, params: Params, path?: string},
public readonly expressReq: Request<Params, ResBody, ReqBody, ReqQuery>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exposing this publicly because I think it's probably going to end up useful eventually.

@@ -1,4 +1,27 @@
3.2.0 (2021-11-23)
4.0.0 (2022-03-31)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I managed to forget to push 30f6e3a until after I submitted this PR, which is why the diff looks odd. This is actually on develop and GitHub is just confused.

Copy link
Contributor

@tadzik tadzik left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I'm curious about this bit though:

The matrix-host-resolver would die if the well known Content-Type was not application/json. While we could be strict, it appears Synapse is not

Is there a bug for Synapse not behaving nicely here?

src/provisioning/api.ts Show resolved Hide resolved
@Half-Shot
Copy link
Contributor Author

Is there a bug for Synapse not behaving nicely here?

I think Synapse is probably doing the correct thing, and in reality well known parsers should try to convert the response into JSON regardless of Content-Type. The problem here is that axios and other HTTP client libraries will not do this unprompted. The spec doesn't mandate a content type, having looked at it. https://spec.matrix.org/v1.2/server-server-api/#resolving-server-names

@Half-Shot Half-Shot merged commit e619476 into develop Apr 7, 2022
@Half-Shot
Copy link
Contributor Author

I did open an issue on matrix-org/matrix-spec#1025

@Half-Shot Half-Shot deleted the hs/provisioner-fixes branch May 2, 2023 16:07
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