Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002972 [JEDI VCL] 00 JVCL Components tweak N/A 2005-05-20 00:53 2006-06-29 13:43
Reporter Simes View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0002972: JvHttpUrlGrabber - cannot configure proxy username or password
Description I was trying to add proxy support myself, when I found issue 2863.

Using the version of TJvUrlListGrabber attached to that issue as a starting point, I think TJvProxyingUrlGrabber needs extending to add a proxy username and password. TJvHttpUrlGrabberThread.Execute should then attach these to hHostConnection using InternetSetOption with the INTERNET_OPTION_PROXY_USERNAME and INTERNET_OPTION_PROXY_PASSWORD options.

BUT, I've tried this, and still get "HTTP 407 Proxy Authentication Required", so I'm missing something. I also get this error when I set proxy mode to pmSysConfig, suggesting the proxy isn't being collected from IE correctly.

(For the purposes of testing, I've hard-coded the proxy username and password into the attached file. Once I've got this to work, I'll extend it properly.)

So any ideas?
Additional Information Delphi 5 on WinXP Pro.
Tags No tags attached.
Attached Files zip file icon JvUrlListGrabber.zip [^] (10,463 bytes) 2005-05-20 00:53
? file icon JvUrlGrabbers.pas [^] (35,533 bytes) 2005-05-20 02:08

- Relationships
child of 0002863resolvedobones Proxy support for JvHttpUrlGrabber 

-  Notes
(0007253)
obones (administrator)
2005-05-20 02:08

Please use the attached JvUrlGrabbers.pas file, it is the one in CVS and this is where the changes need to be done for the password.
JvUrlListGrabber has nothing to do with it.
(0007254)
Simes (reporter)
2005-05-20 02:19

Sorry Olivier - I was using the version out of the latest daily zip, but I attached the wrong file!

I'll test your latest mods and let you know...
(0007255)
Simes (reporter)
2005-05-20 02:37

With either pmManual or pmSysConfig mode, I get "HTTP 407 Proxy Authentication Required"

I'm using
  JvHttpUrlGrabber.ProxyMode := pmManual;
  JvHttpUrlGrabber.ProxyAddresses := 'www-proxy.int.mycompany.com:8080';
  JvHttpUrlGrabber.ProxyUserName := 'username';
  JvHttpUrlGrabber.ProxyPassword := 'password';

where the proxy address is the same as IE shows, and username and password are my actual details that work elsewhere. (The download works fine when I'm not behind a proxy.)

(BTW I had to publish the ProxyUsername and ProxyPassword properties)
(0007259)
obones (administrator)
2005-05-20 02:50

Sorry for not publishing the properties, this is now fixed.
Can you check that the code setting the options is actually called?
I don't have a proxy at work, so cannot test. I will try to get one installed at home and see what is wrong with that code.
(0007270)
Simes (reporter)
2005-05-20 03:24

It's called, but it fails. GetLastError returns 12018:
   12018 ERROR_INTERNET_INCORRECT_HANDLE_TYPE
               The type of handle supplied is incorrect for this
               operation.

(which was why I used InternetSetOption on hHostConnection instead of hSession.)
(0007271)
Simes (reporter)
2005-05-20 03:39

which is strange.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/setting_and_retrieving_internet_options.asp [^]

shows an example that looks just like this.
(0008820)
obones (administrator)
2006-04-03 03:54

Sorry for the delay. I have not yet managed to get hands on a authenticating proxy, but rereading the docs on MSDN made me wonder if the place where the call to InternetSetOption is correct. Could you try using this code:

      if Grabber.ProxyMode in [pmManual, pmSysConfig] then
      begin
        // if manual mode and valid session, we set proxy user name and password
        InternetSetOption(hDownload,
                          INTERNET_OPTION_PROXY_USERNAME,
                          PChar(Grabber.ProxyUserName),
                          Length(Grabber.ProxyUserName)+1);
        InternetSetOption(hDownload,
                          INTERNET_OPTION_PROXY_PASSWORD,
                          PChar(Grabber.ProxyPassword),
                          Length(Grabber.ProxyPassword)+1);
      end;


Right before the call to HttpSendRequest, and commenting out (obviously), the same calls that were applied on the InternetOpen handle.
I would greatly appreciate if you could let me know if that works.
(0008920)
obones (administrator)
2006-04-05 01:14

I've put this change in CVS, we'll see how it goes
(0009452)
obones (administrator)
2006-06-08 04:00

Anyone tested this?
(0009732)
obones (administrator)
2006-06-29 13:43

Ok, I have just tested it on a SQUID 2.5 proxy, and I am glad to say it works just fine.

- Issue History
Date Modified Username Field Change
2005-05-20 00:53 Simes New Issue
2005-05-20 00:53 Simes File Added: JvUrlListGrabber.zip
2005-05-20 02:08 obones File Added: JvUrlGrabbers.pas
2005-05-20 02:08 obones Note Added: 0007253
2005-05-20 02:08 obones Status new => feedback
2005-05-20 02:09 obones Relationship added child of 0002863
2005-05-20 02:19 Simes Note Added: 0007254
2005-05-20 02:37 Simes Note Added: 0007255
2005-05-20 02:50 obones Note Added: 0007259
2005-05-20 03:24 Simes Note Added: 0007270
2005-05-20 03:39 Simes Note Added: 0007271
2005-08-28 09:41 obones Status feedback => assigned
2005-08-28 09:41 obones Assigned To => obones
2006-04-03 03:54 obones Note Added: 0008820
2006-04-03 03:54 obones Status assigned => feedback
2006-04-05 01:14 obones Note Added: 0008920
2006-06-08 04:00 obones Note Added: 0009452
2006-06-29 13:43 obones Status feedback => resolved
2006-06-29 13:43 obones Fixed in Version => 3.20
2006-06-29 13:43 obones Resolution open => fixed
2006-06-29 13:43 obones Note Added: 0009732


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker