Board index » delphi » Error connecting with SSL via proxy with authentication (using TIdHTTP)

Error connecting with SSL via proxy with authentication (using TIdHTTP)

No. You are using Indy 8 which does nto support authentication when
connectiong through proxy server to SSL site.
I suggest you to upgrade to Indy 9 beta and try with it.

Doychin Bondzhev - Team Indy

"Gareth Chandler" <some...@idonotwantanemailaddresshere.com> wrote in
message news:3c43e8ac_2@dnews...

Quote
> When trying to connect with SSL via a proxy server using a TidHTTP
component
> and a TidConnectionInterceptOpenSSL component, I received the error "Error
> connecting with SSL". This was exception was raised because a connection
> with the server had notbeen established, as the client had not
authenticated
> to the proxy.

> From what I can see, connection to a proxy when using SSL takes place in
the
> method 'TIdHTTP.DoProxyConnectMethod'. I changed the code in there to the
> following (which solved the problem):

> procedure TIdHTTP.DoProxyConnectMethod(ASender: TObject);

> var

> sPort: string;

> i: Integer; // added

> begin

> {

> OLD CODE:

> InterceptEnabled := False;

> sPort := IntToStr(FTunnelProxyPort);

> WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

> FTunnelProxyProtocol);

> WriteLn;

> ReadLn;

> ReadLn;

> ReadLn;

> InterceptEnabled := True;

> }

> InterceptEnabled := False;

> sPort := IntToStr(FTunnelProxyPort);

> WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

> FTunnelProxyProtocol);

> // Added headers which include 'Proxy-Authorization: ' header

> Request.SetHeaders(FInternalHeaders);

> for i := 0 to FInternalHeaders.Count - 1 do

> WriteLn(FInternalHeaders[i]);

> WriteLn;

> ReadLn;

> ReadLn;

> // ReadLn; Removed - There were only two response lines from the server

> InterceptEnabled := True;

> end;

> Could anyone tell me if there is another way of doing this(Without
changing
> any Indy code)?

> Thanks,

> Gareth Chandler

 

Re:Error connecting with SSL via proxy with authentication (using TIdHTTP)


When trying to connect with SSL via a proxy server using a TidHTTP component
and a TidConnectionInterceptOpenSSL component, I received the error "Error
connecting with SSL". This was exception was raised because a connection
with the server had notbeen established, as the client had not authenticated
to the proxy.

From what I can see, connection to a proxy when using SSL takes place in the
method 'TIdHTTP.DoProxyConnectMethod'. I changed the code in there to the
following (which solved the problem):

procedure TIdHTTP.DoProxyConnectMethod(ASender: TObject);

var

sPort: string;

i: Integer; // added

begin

{

OLD CODE:

InterceptEnabled := False;

sPort := IntToStr(FTunnelProxyPort);

WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

FTunnelProxyProtocol);

WriteLn;

ReadLn;

ReadLn;

ReadLn;

InterceptEnabled := True;

Quote
}

InterceptEnabled := False;

sPort := IntToStr(FTunnelProxyPort);

WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

FTunnelProxyProtocol);

// Added headers which include 'Proxy-Authorization: ' header

Request.SetHeaders(FInternalHeaders);

for i := 0 to FInternalHeaders.Count - 1 do

WriteLn(FInternalHeaders[i]);

WriteLn;

ReadLn;

ReadLn;

// ReadLn; Removed - There were only two response lines from the server

InterceptEnabled := True;

end;

Could anyone tell me if there is another way of doing this(Without changing
any Indy code)?

Thanks,

Gareth Chandler

Re:Error connecting with SSL via proxy with authentication (using TIdHTTP)


Thanks.

"Doychin Bondzhev - Team Indy" <doyc...@dsoft-bg.com> wrote in message
news:3c43e97f_1@dnews...

Quote
> No. You are using Indy 8 which does nto support authentication when
> connectiong through proxy server to SSL site.
> I suggest you to upgrade to Indy 9 beta and try with it.

> Doychin Bondzhev - Team Indy

> "Gareth Chandler" <some...@idonotwantanemailaddresshere.com> wrote in
> message news:3c43e8ac_2@dnews...
> > When trying to connect with SSL via a proxy server using a TidHTTP
> component
> > and a TidConnectionInterceptOpenSSL component, I received the error
"Error
> > connecting with SSL". This was exception was raised because a connection
> > with the server had notbeen established, as the client had not
> authenticated
> > to the proxy.

> > From what I can see, connection to a proxy when using SSL takes place in
> the
> > method 'TIdHTTP.DoProxyConnectMethod'. I changed the code in there to
the
> > following (which solved the problem):

> > procedure TIdHTTP.DoProxyConnectMethod(ASender: TObject);

> > var

> > sPort: string;

> > i: Integer; // added

> > begin

> > {

> > OLD CODE:

> > InterceptEnabled := False;

> > sPort := IntToStr(FTunnelProxyPort);

> > WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

> > FTunnelProxyProtocol);

> > WriteLn;

> > ReadLn;

> > ReadLn;

> > ReadLn;

> > InterceptEnabled := True;

> > }

> > InterceptEnabled := False;

> > sPort := IntToStr(FTunnelProxyPort);

> > WriteLn('CONNECT ' + FTunnelProxyHost + ':' + sPort + ' HTTP/' +

> > FTunnelProxyProtocol);

> > // Added headers which include 'Proxy-Authorization: ' header

> > Request.SetHeaders(FInternalHeaders);

> > for i := 0 to FInternalHeaders.Count - 1 do

> > WriteLn(FInternalHeaders[i]);

> > WriteLn;

> > ReadLn;

> > ReadLn;

> > // ReadLn; Removed - There were only two response lines from the server

> > InterceptEnabled := True;

> > end;

> > Could anyone tell me if there is another way of doing this(Without
> changing
> > any Indy code)?

> > Thanks,

> > Gareth Chandler

Other Threads