Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure RunServer(APort: Integer);
- var
- LServer: TIdHTTPWebBrokerBridge;
- LGetSSLPassword: TGetSSLPassword;
- LIOHandleSSL: TIdServerIOHandlerSSLOpenSSL;
- begin
- Writeln(Format('Starting DMVCFramework HTTPS Server or port %d', [APort]));
- LGetSSLPassword := nil;
- LServer := TIdHTTPWebBrokerBridge.Create(nil);
- try
- LGetSSLPassword := TGetSSLPassword.Create;
- LIOHandleSSL := TIdServerIOHandlerSSLOpenSSL.Create(LServer);
- LIOHandleSSL.SSLOptions.SSLVersions := [
- TIdSSLVersion.sslvSSLv23,
- TIdSSLVersion.sslvSSLv3,
- TIdSSLVersion.sslvTLSv1,
- TIdSSLVersion.sslvTLSv1_1,
- TIdSSLVersion.sslvTLSv1_2
- ];
- LIOHandleSSL.SSLOptions.Mode := sslmServer;
- LIOHandleSSL.SSLOptions.CertFile := 'cacert.pem';
- LIOHandleSSL.SSLOptions.RootCertFile := '';
- LIOHandleSSL.SSLOptions.KeyFile := 'privkey.pem';
- LIOHandleSSL.OnGetPassword := LGetSSLPassword.OnGetSSLPassword;
- LServer.IOHandler := LIOHandleSSL;
- LServer.DefaultPort := APort;
- LServer.Active := True;
- Writeln('Press RETURN to stop the server');
- ReadLn;
- finally
- LServer.Free;
- LGetSSLPassword.Free;
- end;
- end;
Add Comment
Please, Sign In to add comment