You have to use FMyExternalSslSessionCache->GetSvrSession() and
FMyExternalSslSessionCache->CacheSvrSession()!
It is also required to set the SslContest.SslSessionCacheModes properly:
[sslSESS_CACHE_SERVER,sslSESS_CACHE_NO_INTERNAL_LOOKUP,sslSESS_CACHE_NO_INTERNAL_STORE]
Delphi code:
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSslWebServForm.SslHttpServer1SslSetSessionIDContext(
Sender : TObject;
var SessionIDContext : String);
begin
{ Tell Openssl a Session_ID_Context. }
{ Openssl uses this data to tag a session before it's cached. }
{ It's an arbitrary custom string }
SessionIDContext := Ssl_Session_ID_Context;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSslWebServForm.SslHttpServer1SslSvrGetSession(
Sender : TObject;
var SslSession : Pointer;
SessId : Pointer;
Idlen : Integer;
var IncRefCount : Boolean);
var
LookupKey : string;
begin
SetLength(LookupKey, IDLen);
Move(SessId^, Pointer(LookupKey)^, IDLen);
SslSession := SslAvlSessionCache1.GetSvrSession(LookupKey +
Ssl_Session_ID_Context,
IncRefCount);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSslWebServForm.SslHttpServer1SslSvrNewSession(
Sender : TObject;
SslSession,
SessId : Pointer;
Idlen : Integer;
var AddToInternalCache : Boolean);
var
LookupKey : string;
begin
SetLength(LookupKey, IDLen);
Move(SessId^, Pointer(LookupKey)^, IDLen);
SslAvlSessionCache1.CacheSvrSession(SslSession,
LookupKey + Ssl_Session_ID_Context,
AddToInternalCache);
if DisplaySslInfoCheckBox.Checked then
Display('[' + FormatDateTime('HH:NN:SS', Now) + ' ' +
TWSocket(Sender).GetPeerAddr + '] New SSL session created and '
+
'cached in external cache class.');
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
--
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be