Using Tidhttp and SSL getting a socket error

Giganews Newsgroups
Subject: Using Tidhttp and SSL getting a socket error
Posted by:  Jayc Salter (ja…@registriesltd.com.au)
Date: Thu, 17 Aug 2006

Hi there

i am working on a little app using Indy components to access a webpage
(after logging into it).
My intention is to eventually download a file from that page.
This is the first time i have worked on something like this so please
excuse any ignorance on my part

i have managed to get the little app to login to a site but when i
attempt to use the same code to get into a secure site i get problems.
(HTTP works HTTPS does not)

the only difference between the code that works and that that doesnt is
that i assign a TIdSSLHandler for the secure site.

i get a "Socket Error # 11004" error when i attempt to post (or get)

I use the following code:

var
  poststring : TStringList;
  postresult : string;
begin
    poststring := TStringList.Create;
    poststring.Values['username'] := 'SomeUSerName';
    poststring.Values['password'] := 'TheCorrectPassword';

  try
    //This is the additional line of code that is different to the code
that works >>
    IdHTTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;

    //I get the error on this line of code >>
    postresult :=
IdHTTP1.Post('https://www.somesite.com/pub/login.cgi/login', poststring);

    RichEdit2.Clear;
    RichEdit2.Lines.Add(postresult);
  finally
    poststring.Free;
  end;
end;

Thanks for your help

Replies