#1 2015-01-22 21:47:41

BBackSoon
Member
Registered: 2014-11-15
Posts: 41

TWinHTTP(API) IgnoreSSLCertificateErrors property not propagated

Hello,

I was trying to set the IgnoreSSLCertificateErrors property of the TWinHTTPAPI object from within a TSQLHttpClientWinHTTP, but I encountered a problem.

Here's the code I wrote:

aClient := TSQLHttpClientWinHTTP.Create(addr, SERVER_PORT, aModel, true);
aClient.WinAPI.IgnoreSSLCertificateErrors:=true; // ERROR because aClient.WinAPI is still nil here

Examining your code I have noticed that TSQLHttpClientWinHTTP.Create does not create its WinAPI internal object, such object is created by the InternalCheckOpen method.

As a temporary solution I have modified the code of your TSQLHttpClientWinHTTP.Create constructor as follows:

constructor TSQLHttpClientWinGeneric.Create(const aServer, aPort: AnsiString;
  aModel: TSQLModel; aHttps: boolean; const aProxyName, aProxyByPass: AnsiString;
  SendTimeout,ReceiveTimeout: DWORD);
begin
  inherited Create(aServer,aPort,aModel);
  fHttps := aHttps;
  fProxyName := aProxyName;
  fProxyByPass := aProxyByPass;
  fSendTimeout := SendTimeout;
  fReceiveTimeout := ReceiveTimeout;
  InternalCheckOpen;  // added this line
end;

But it's not a clean solution. I think that propagating/adding the IgnoreSSLCertificateErrors property also to the TSQLHttpClientWinHTTP class would be the best way to achieve the goal.
What do you think?

Offline

#2 2015-01-23 19:58:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TWinHTTP(API) IgnoreSSLCertificateErrors property not propagated

I've added TSQLHttpClientWinGeneric.IgnoreSSLCertificateErrors property to set the corresponding parameter for the underlying connection.
See http://synopse.info/fossil/info/94d6e38989

Thanks for the feedback!

Offline

#3 2015-01-23 22:51:00

BBackSoon
Member
Registered: 2014-11-15
Posts: 41

Re: TWinHTTP(API) IgnoreSSLCertificateErrors property not propagated

That's perfect. Thank you!

Offline

Board footer

Powered by FluxBB