@@ -23,7 +23,8 @@ interface
2323uses
2424 Classes, SysUtils, { $IFDEF FPC} CustApp,{ $ENDIF} IdIOHandler, IdHTTP,
2525 IdSSL, IdSSLOpenSSL, IdHeaderList, IdContext,
26- IdCustomHTTPServer, IdHTTPServer, IdServerIOHandler, IdGlobal;
26+ IdCustomHTTPServer, IdHTTPServer, IdServerIOHandler, IdGlobal,
27+ IdSSLOpenSSLX509;
2728
2829const
2930 SSLServerPort = 8080 ;
@@ -77,6 +78,7 @@ TOpenSSLServerTest = class(TCustomApplication)
7778 function IsDirectoryEmpty (Path: string): boolean;
7879 procedure HandleCommandGet (AContext: TIdContext;
7980 ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
81+ procedure HandleStatusInfo (const AMsg: String);
8082 procedure GetMyPassword (var Password: String);
8183 procedure QuerySSLPort (APort: TIdPort; var VUseSSL: Boolean);
8284 function CertificateType (Certificate: TIdX509): string;
@@ -103,7 +105,7 @@ TResponseTextBuffer = class(TMemoryStream)
103105
104106implementation
105107
106- uses IdSSLOpenSSLAPI;
108+ uses IdSSLOpenSSLAPI, IdSSLOpenSSLOptions ;
107109
108110{ $IFDEF LOCAL_TCUSTOMAPP}
109111function TCustomApplication.Exename : string;
@@ -217,9 +219,12 @@ function TOpenSSLServerTest.GetSSLServerHandler(AOwner : TComponent
217219 IOHandler.SSLOptions.RootCertFile := MyRootCertFile;
218220 IOHandler.SSLOptions.CertFile := MyCertFile;
219221 IOHandler.SSLOptions.KeyFile := MyKeyFile;
222+ { $IFDEF LEGACY_VERSION}
220223 IOHandler.SSLOptions.Method := sslvTLSv1_2;
224+ { $ENDIF}
221225 IOHandler.OnGetPassword := GetMyPassword;
222226 IOHandler.OnVerifyPeer := ServerVerifyPeer;
227+ IOHandler.OnStatusInfo := HandleStatusInfo;
223228 if FClientVerification then
224229 begin
225230 IOHandler.SSLOptions.VerifyMode := [sslvrfPeer,sslvrfFailIfNoPeerCert];
@@ -257,6 +262,11 @@ procedure TOpenSSLServerTest.HandleCommandGet(AContext: TIdContext;
257262 AResponseInfo.ContentStream.Position := 0 ;
258263end ;
259264
265+ procedure TOpenSSLServerTest.HandleStatusInfo (const AMsg: String);
266+ begin
267+ writeln(' Server Status Info: ' ,AMsg);
268+ end ;
269+
260270procedure TOpenSSLServerTest.GetMyPassword (var Password : String);
261271begin
262272 Password := myPassword;
@@ -326,8 +336,6 @@ procedure TOpenSSLServerTest.DoRun;
326336 writeln(' LibCrypto: ' ,GetIOpenSSLDDL.GetLibCryptoFilePath);
327337 writeln(' LibSSL: ' ,GetIOpenSSLDDL.GetLibSSLFilePath);
328338 end ;
329- if not LoadOpenSSLLibrary then
330- raise Exception.Create(' OpenSSL Library Failed to load' );
331339
332340 if GetIOpenSSLDDL <> nil then
333341 with GetIOpenSSLDDL.GetFailedToLoadList do
0 commit comments