Microsoft ISA 2004 firewall and IdHTTP.Post / Connect / Connected

Giganews Newsgroups
Subject: Microsoft ISA 2004 firewall and IdHTTP.Post / Connect / Connected
Posted by:  Andrew Fiddian-Green (…@dd)
Date: Mon, 14 Aug 2006

Before starting a lengthy upload process with TIdHTTP.Post using SSL I would
like to do a fast pre- check "ping" to determine which of the client
machine's local addresses will (most likely) result in success.

At present I use HTTP.Connect() followed by a test for HTTP.Connected to
confirm if the client can establish a TCP connection to the server; and if
this works I proceed with the full blown HTTP.Post (see code below)

In the majority of network configurations my code seems to work fine, but I
discovered that if the client is behind a Microsoft ISA 2004 firewall the
HTTP.Connect() and HTTP.Connected test always fails -- even though the
firewall is configured to pass HTTP calls. I suppose this is because
HTTP.Connect() works below the HTTP level, and the firewall won't actually
allow the connection until it "knows" that it is carrying an HTTP payload.

=> Does anyone have any suggestions for a better way of doing such a fast
pre- check "ping" ?

Regards,
AndrewFG

<code>
Ok := false;

Str := TStringList.Create;
Str.AddStrings(GStack.LocalAddresses);
i := Str.Count;

repeat
  Dec(i);
  HTTP.BoundIP := Str[i];
  try
    HTTP.Connect(URI.Host, 80);
    Ok := HTTP.Connected;
  except
      on E: Exception do ;
  end;
until Ok or (i = 0);

if Ok then
begin
  do the upload...
end;
</code>

Replies