Delphi 2007: SSL ignore check certificate and 404 error

0

I'm having a rest connection(username and password protected) and I'd like to ignore SSL certificate check.

In C#:

public class TrustAllCertificatePolicy : ICertificatePolicy
{
    private const uint CERT_E_UNTRUSTEDROOT = 0x800B0109;

    public TrustAllCertificatePolicy()
    {
    }

    public bool CheckValidationResult(ServicePoint sp,
        X509Certificate cert, WebRequest req, int problem)
    {
        bool returnValue = problem == 0;

        if ((uint)problem == CERT_E_UNTRUSTEDROOT)
            returnValue = true;
        return returnValue;
    }
}

I want to do the same in Delphi 2007. Is it possible?

Actually I do:

URL:= 'https://hw1200122:8444/WsConduit/ConduitService/SyncData/1';
HttpClient := TIdHttp.Create(nil);
HttpClient.ConnectTimeout := 5000;
HttpClient.ReadTimeout := 5000;
HttpClient.OnAuthorization := httpAuthorization;
HttpClient.MaxAuthRetries := 0;
HttpClient.HTTPOptions := [hoInProcessAuth];
HttpClient.Request.RawHeaders.Clear;
HttpClient.Request.RawHeaders.AddStrings(Self.FHeaders);
HttpClient.Request.BasicAuthentication := true;
HttpClient.Request.Username := Self.FUsername;
HttpClient.Request.Password := Self.FPassword;
httpClient.Request.ContentType := 'application/zip';
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
httpClient.IOHandler := LHandler;
try    
  respStr := httpClient.Get(URL);
  Result.ResponseCode := httpClient.ResponseCode;
  Result.ResponseStr := respStr;
except
  on E: EIdHTTPProtocolException do
  begin
    Result.ResponseCode := httpClient.ResponseCode;
    Result.ResponseStr := E.Message;
  end;
end;

I get 404 error:

'HTTP/1.1 404 Not Found'

What's the problem?

delphi
rest
ssl
ignore
asked on Stack Overflow Apr 26, 2013 by user2075861

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0