comparison mod_rest/mod_rest.lua @ 4727:e6f46d1b3337

mod_rest: Set type on temp session to satisfy certain auth checks E.g. mod_external_services and some others use `origin.type == "c2s"` as access check, which rejected the previous nil value.
author Kim Alvefur <zash@zash.se>
date Tue, 26 Oct 2021 18:07:35 +0200
parents a8af632daf48
children e58ec4b3cf90
comparison
equal deleted inserted replaced
4726:611bc06c4160 4727:e6f46d1b3337
240 origin = check_credentials(request); 240 origin = check_credentials(request);
241 if not origin then 241 if not origin then
242 return post_errors.new("unauthz"); 242 return post_errors.new("unauthz");
243 end 243 end
244 from = jid.join(origin.username, origin.host, origin.resource); 244 from = jid.join(origin.username, origin.host, origin.resource);
245 origin.type = "c2s";
245 end 246 end
246 local payload, err = parse_request(request, path); 247 local payload, err = parse_request(request, path);
247 if not payload then 248 if not payload then
248 -- parse fail 249 -- parse fail
249 local ctx = { error = err, type = request.headers.content_type, data = request.body, }; 250 local ctx = { error = err, type = request.headers.content_type, data = request.body, };