0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-04 09:38:37 +02:00

modules/s_fetch: Use the event origin as fallback host.

This commit is contained in:
Jason Volk 2019-04-24 21:30:05 -07:00
parent 54e5b2273f
commit 4b70ae70c7

View file

@ -404,7 +404,14 @@ try
if(opts.fetch_auth_check && auth_exists < auth_count) if(opts.fetch_auth_check && auth_exists < auth_count)
{ {
if(!opts.fetch_auth || !bool(m::fetch::enable) || !eval.opts->node_id) const net::hostport remote
{
eval.opts->node_id?
eval.opts->node_id:
json::get<"origin"_>(event)
};
if(!opts.fetch_auth || !bool(m::fetch::enable) || !remote || my_host(host(remote)))
throw vm::error throw vm::error
{ {
vm::fault::EVENT, "Failed to fetch auth_events for %s in %s", vm::fault::EVENT, "Failed to fetch auth_events for %s in %s",
@ -412,7 +419,7 @@ try
json::get<"room_id"_>(*eval.event_) json::get<"room_id"_>(*eval.event_)
}; };
auth_chain(room, eval.opts->node_id); auth_chain(room, remote);
} }
const size_t prev_count const size_t prev_count