You are not logged in.
Pages: 1
in this code
function TRestServerUriContext.Authenticate: boolean;
...
begin
...
if (rsoSessionInConnectionOpaque in Server.Options) and
(Call^.LowLevelConnectionOpaque <> nil) then
begin
// TAuthSession instance may have been stored at connection level
// to avoid signature parsing and session lookup
s := pointer(Call^.LowLevelConnectionOpaque^.ValueInternal);
if s <> nil then
if s.InheritsFrom(Server.fSessionClass) then
begin
SessionAssign(s); <<<<<<<<<<<<<<<<<<<<< here does
exit;
end
else
Call^.LowLevelConnectionOpaque^.ValueInternal := 0; // paranoid
end;
// parse signature to retrieve the associated session
Server.fSessions.Safe.ReadOnlyLock; // allow concurrent authentication
try
a := pointer(Server.fSessionAuthentication);
if a <> nil then
begin
n := PDALen(PAnsiChar(a) - _DALEN)^ + _DAOFF;
repeat
s := a^.RetrieveSession(self); // retrieve from URI or cookie
if s <> nil then
begin
if (Log <> nil) and
(s.RemoteIP <> '') and
(s.RemoteIP <> '127.0.0.1') then
Log.Log(sllUserAuth, '%/% %',
[s.User.LogonName, s.ID, s.RemoteIP], self);
SessionAssign(s) <<<<<< are not missing this here????
exit;
end;
inc(a);
dec(n);
until n = 0;
end;
...
end;
Offline
Did you debug a little?
It sounds like if RetrieveSession() calls LockedSessionAccess() which eventually calls SessionAssign().
This path is just a bit more complex because we need to lock and call a virtual method to get the ID from the URI, then O(log(n)) look binary search into the session array, then unlock.
Whereas with the opaque pointer trick we don't need any lock, and we have the session directly with O(1) complexity.
Offline
Pages: 1