Board index » delphi » Access violation using SSL with HTTP Client

Access violation using SSL with HTTP Client

I'm using the TIdHTTP and TIdConnectionInterceptOpenSSL components to set up
a connection with a HTTP server.  The server works (tested using IE5 as a
client), but I can't get the TIdConnectionInterceptOpenSSL component to
behave.  In all my apps, and in the Indy SSL Client demo project, I get an
access violation in the TIdConnectionInterceptOpenSSL component when I use
the Get(URL:string):string method of the TIdHTTP component.  I've included
the method that causes the AV below, it occurs on the first line, because
the fSSLSocket property is nil.

Looking through the code, fSSLSocket should be instantiated in the Connect
method of the intercept, but never gets called.  Anybody run into this one
before?

This is the code that causes the AV (on the line immediately after begin):

function TIdConnectionInterceptOpenSSL.Send(var ABuf; ALen: Integer):
Integer;
begin
  Result := IdSslWrite(fSSLSocket.fSSL, @ABuf, ALen);
  while (GetSSLError(Result) = OPENSSL_SSL_ERROR_WANT_WRITE) do begin
    Result := IdSslWrite(fSSLSocket.fSSL, @ABuf, ALen);
  end;
end;

 

Re:Access violation using SSL with HTTP Client


Download the latest version. This was a bug.

Regards,
Gregor

Quote
"Scott Sedgwick" <sc...@entellect.com.au> wrote in message

news:8uvr82$gen13@bornews.inprise.com...
Quote
> I'm using the TIdHTTP and TIdConnectionInterceptOpenSSL components to set
up
> a connection with a HTTP server.  The server works (tested using IE5 as a
> client), but I can't get the TIdConnectionInterceptOpenSSL component to
> behave.  In all my apps, and in the Indy SSL Client demo project, I get an
> access violation in the TIdConnectionInterceptOpenSSL component when I use
> the Get(URL:string):string method of the TIdHTTP component.  I've included
> the method that causes the AV below, it occurs on the first line, because
> the fSSLSocket property is nil.

> Looking through the code, fSSLSocket should be instantiated in the Connect
> method of the intercept, but never gets called.  Anybody run into this one
> before?

> This is the code that causes the AV (on the line immediately after begin):

> function TIdConnectionInterceptOpenSSL.Send(var ABuf; ALen: Integer):
> Integer;
> begin
>   Result := IdSslWrite(fSSLSocket.fSSL, @ABuf, ALen);
>   while (GetSSLError(Result) = OPENSSL_SSL_ERROR_WANT_WRITE) do begin
>     Result := IdSslWrite(fSSLSocket.fSSL, @ABuf, ALen);
>   end;
> end;

Re:Access violation using SSL with HTTP Client


I wanted to make sure of this, so I checked - if this bug has been fixed,
then it was re-introduced.  I just cleaned up my system completely, and
installed Indy 8.008b (the version I thought I was using) and still get this
error.  I did have the feeling that I had once had SSL clients working with
an earlier version of Indy, so thanks - now I know I'm not going mad.
Unfortunately, the problem isn't solved.

Does anyone know what was done to fix the bug before?  I know that the
intercepts connect method isn't being called from the TIdHTTP component
(though the diconnect method is), and I've tried putting code in a couple of
spots calling it.  The problem is, I don't know when the SSL handshake is
meant to be done, so I'm getting things out of order and SSL is throwing me
out.  Where should the SSL intercepts connect method be called, and should
it override any of the existing socket connection handshake?

Thanks for your help,

Scott.

Quote
"Gregor Ibic" <gregor.i...@intelicom.si> wrote in message

news:8v0a2d$q675@bornews.inprise.com...
Quote
> Download the latest version. This was a bug.

> Regards,
> Gregor

Re:Access violation using SSL with HTTP Client


OK.  I'm an idiot.  I THOUGHT version 8.008b was the latest, but you caught
me out.  I've just got 8.009b and good news!  Problem solved.  Sorry for the
inconvenience.

Scott.

Quote
"Scott Sedgwick" <sc...@entellect.com.au> wrote in message

news:8v1keo$gr812@bornews.inprise.com...
Quote
> I just cleaned up my system completely, and installed Indy 8.008b (the

version I thought I was using) and still get this error.

Re:Access violation using SSL with HTTP Client


It's ok. I'm dumber every day.

Regards,
Gregor

Quote
"Scott Sedgwick" <sc...@entellect.com.au> wrote in message

news:8v1mad$gr514@bornews.inprise.com...
Quote
> OK.  I'm an idiot.  I THOUGHT version 8.008b was the latest, but you
caught
> me out.  I've just got 8.009b and good news!  Problem solved.  Sorry for
the
> inconvenience.

> Scott.

> "Scott Sedgwick" <sc...@entellect.com.au> wrote in message
> news:8v1keo$gr812@bornews.inprise.com...
> > I just cleaned up my system completely, and installed Indy 8.008b (the
> version I thought I was using) and still get this error.

Other Threads