Processing Proxy Autoconfig files with Indy

All,

I've written a small client COM object with Indy 9 which allows apps
to POST XML data to a server side ASP page for processing.

After quite a bit of hacking (Indy's urlencoding wasn't being very
helpful) I got an DLL working which could reliably send data to a
target ASP page.
Both the client and server worked when they where on the same machine.

Then the fun started. I installed the COM DLL and test app on another
machine and tried to send data to my server.

After a lot of troubleshooting, it turned out that the lack of support
for proxy autoconfig in Indy was my problem.

When I hard coded the proxy server and port no. into the client dll,
it works fine.

But if I point it at a URI which returns a .pac (proxy autoconfig
file), Indy does nothing because it does not know how to parse .pac
files.

.pac files are a set of rules that are normally processed by some
JavaScript functions. Given a destination URI, the function will
normally return the proxy server to use or return a default. Indy then
just needs to use that proxy server as if it where a static setting.

It turns out that there is a solution to this problem on W*****ws. A
file called jsproxy.dll is the parser MS uses for IE to do proxy
autoconfig.

There's a function within this DLL which will parse a .pac file and
return the appropriate proxy server, but I don't know how to call the
function and it's only recently been "documented" by MS.

Can anyone tell me how to call this function in Delphi.

BOOL InternetGetProxyInfo(
  LPCSTR lpszUrl,
  DWORD dwUrlLength,
  LPSTR lpszUrlHostName,
  DWORD dwUrlHostNameLength,
  LPSTR* lplpszProxyHostName,
  LPDWORD lpdwProxyHostNameLength
);

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wini...
for an explanation of the parameters.

The alternative long term solution is to try port Mozilla's proxy
autoconfig parser to Delphi

Any help would be greatly appreciated.
Regards
Michael O'Reilly