How can I download portions of a file if I am behind a proxy and don't want the proxy authentication dialog to pop up each time?
I have an ActiveX browser plugin (running in low integrity mode) and I am behind a proxy which requires authentication. Now I'd like to download a file without getting Internet Explorer's proxy log-in dialog every time. I have discovered functions like URLDownloadToFile, URLOpenStream and InternetOpenUrl. Some of these work as expected, but they always download the whole file. The files I am dealing with can be very huge. So I want to be able to use the HTTP request-range header to download only specific portions of the file.
I have found the ZipReader sample here: http://support.microsoft.com/kb/223500 . This sample can add the request-range header to the http GET request, but it is prompting the proxy login dialog.
So again, How can I download portions of a file if I am behind a proxy and don't want the proxy authentication dialog to pop up each time?
Thanks for you help!
I think you can use URLDownloadToFile and return E_ABORT in your status callback that implements IBindStatusCallback, IAuthenticate, IAuthenticate2 and IHttpSecurity to cancel the download.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
Visual C++ MVP
Thanks for your help!
I think the answer is this: Internet explorer uses WinInet functions. WinInet has an implicit session state which is kept per-instance (this is the hard-to-find information, I found one or two blog posts mentioning it). This session state includes the proxy authentication information. So the above functions will work, when used from within the same process, but they will fail if used from a child process, becaues it seems the HINTERNET handles cannot be inherited from a parent process to a child process.
The solution is to employ some sort of IPC between the child process (making requests to the parent process) and the plugin's main process (which is the internet explorer process and thus can perform the real downloads). However, I have not implemented this yet.