Skip to content

Fix push URLs to match the spec.#986

Merged
clokep merged 2 commits into
developfrom
clokep/pusher-url
Dec 4, 2020
Merged

Fix push URLs to match the spec.#986
clokep merged 2 commits into
developfrom
clokep/pusher-url

Conversation

@clokep
Copy link
Copy Markdown
Member

@clokep clokep commented Dec 2, 2020

This matches matrix-org/synapse#8865 to ensure the push URLs match the spec.

@clokep clokep requested a review from a team December 2, 2020 20:50
Copy link
Copy Markdown
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

in principle this looks good, but it seems like there are more instances of non-compliance.

@clokep
Copy link
Copy Markdown
Member Author

clokep commented Dec 3, 2020

Sorry about that! I thought I caught all the instances. 😢

@clokep clokep requested a review from a team December 3, 2020 18:05
Comment on lines +28 to 43
await_http_request( $PUSH_LOCATION, sub {
my ( $request ) = @_;
my $body = $request->body_from_json;

# Respond to all requests, even if we filter them out
$request->respond_json( $response // {} );

return unless $body->{notification}{type};
return unless $body->{notification}{type} eq "m.room.message";

# Ensure this is the expected pusher.
return unless $body->{notification}{devices};
return unless $body->{notification}{devices}[0]{pushkey} eq $pushkey;

# Respond to expected request.
$request->respond_json( $response // {} );

return 1;
});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is attempting to check one of the fields of the request instead of differentiating on URL.

@clokep clokep merged commit fd84283 into develop Dec 4, 2020
@clokep clokep deleted the clokep/pusher-url branch December 4, 2020 14:56
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.

3 participants