View Issue Details

IDProjectCategoryView StatusLast Update
0002972JEDI VCL00 JVCL Componentspublic2006-06-29 13:43
ReporterSimesAssigned Toobones 
PrioritynormalSeveritytweakReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.20 
Summary0002972: JvHttpUrlGrabber - cannot configure proxy username or password
DescriptionI 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 InformationDelphi 5 on WinXP Pro.
TagsNo tags attached.

Relationships

child of 0002863 resolvedobones Proxy support for JvHttpUrlGrabber 

Activities

2005-05-20 00:53

 

JvUrlListGrabber.zip (10,463 bytes)

2005-05-20 02:08

 

JvUrlGrabbers.pas (35,533 bytes)

obones

2005-05-20 02:08

administrator   ~0007253

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.

Simes

2005-05-20 02:19

reporter   ~0007254

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...

Simes

2005-05-20 02:37

reporter   ~0007255

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)

obones

2005-05-20 02:50

administrator   ~0007259

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.

Simes

2005-05-20 03:24

reporter   ~0007270

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.)

Simes

2005-05-20 03:39

reporter   ~0007271

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.

obones

2006-04-03 03:54

administrator   ~0008820

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.

obones

2006-04-05 01:14

administrator   ~0008920

I've put this change in CVS, we'll see how it goes

obones

2006-06-08 04:00

administrator   ~0009452

Anyone tested this?

obones

2006-06-29 13:43

administrator   ~0009732

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