I’m trying to create a custom
http:authenticate/3 method and it’s doing weird stuff in SWI-Prolog version 8.0.3.
My code works as expected in version 7.6.4 but after upgrading, no cigar!
http:authenticate(my_auth_type, _Request, [user(anonymous)]). :- http_handler(root(.), home, [authentication(my_auth_type)]). home(Request) :- memberchk(user(User), Request), ...
The http:authenticate method is being called BUT the user is not being passed to the handler in the request. I traced the problem to following code in the http_dispatch library code:
auth_expansion(Request0, Request, Options) :- authentication(Options, Request0, Extra), append(Extra, Request, Request0).
(This is new mechanism in the upgraded version by the looks)
It looks like Request0 is the original request, Request is the modified request, but the append does not resolve obviously because the user is not in the Request0 already.
My question is, am I missing something obvious here or is this bug?