Skip Menu |

This queue is for tickets about the WWW-HtmlUnit CPAN distribution.

Report information
The Basics
Id: 73535
Status: resolved
Priority: 0/
Queue: WWW-HtmlUnit

People
Owner: awwaiid [...] thelackthereof.org
Requestors: zhzhang [...] knight.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: no proxy settings..
Date: Wed, 28 Dec 2011 10:22:23 -0500
To: "'bug-WWW-HtmlUnit [...] rt.cpan.org'" <bug-WWW-HtmlUnit [...] rt.cpan.org>
From: "Zhang, Zhengquan" <zhzhang [...] knight.com>
Hello The constructor doesn't accept proxy settings. Pls advise.. Jim. Please visit our website for important disclaimers/disclosures regarding Knight's products and services: http://knight.com/KnightEmailDisclaimer.html
For an immediate work-around, try this: use WWW::HtmlUnit; use Inline::Java qw(study_classes); study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], 'WWW::HtmlUnit'); my $proxy_config = WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( 'proxy.example.com', # proxy host '8080', # proxy port ); my $webClient = WWW::HtmlUnit->new; $webClient->setProxyConfig($proxy_config); (untested) I've made a note to add something easier in a future release of WWW::HtmlUnit (or at least WWW::HtmlUnit::Sweet). Let me know if this works, --Brock On Wed Dec 28 10:22:34 2011, zhzhang@knight.com wrote: Show quoted text
> Hello > The constructor doesn't accept proxy settings. > > Pls advise.. > Jim. > > Please visit our website for important disclaimers/disclosures > regarding Knight's products and services: > > http://knight.com/KnightEmailDisclaimer.html >
Subject: Re: [rt.cpan.org #73535] no proxy settings..
Date: Wed, 28 Dec 2011 11:00:49 -0500
To: Brock Wilcox via RT <bug-WWW-HtmlUnit [...] rt.cpan.org>
From: "Zhang, Zhengquan" <zhzhang [...] knight.com>
On Wed, Dec 28, 2011 at 10:50:58AM -0500, Brock Wilcox via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73535 > > > > For an immediate work-around, try this: > > use WWW::HtmlUnit; > use Inline::Java qw(study_classes); > > study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], > 'WWW::HtmlUnit'); > my $proxy_config = > WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( > 'proxy.example.com', # proxy host > '8080', # proxy port > ); > > my $webClient = WWW::HtmlUnit->new; > $webClient->setProxyConfig($proxy_config); > > (untested) > > I've made a note to add something easier in a future release of > WWW::HtmlUnit (or at least WWW::HtmlUnit::Sweet).
Hi Brock: it doens't compile and setting password/username doesn't work which are commented out. here my test.pl: use strict; use warnings; use WWW::HtmlUnit; use Inline::Java qw(study_classes); study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], 'WWW::HtmlUnit'); my $proxy_config = WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( 'http://statarb:sT4tArB@jc1prxy2', 8080, ); my $webClient = WWW::HtmlUnit->new; webClient->setProxyConfig($proxy_config); #my ($username,$password)=qw/statarb sT4tArB/; #my $credentialsProvider = $webclient->getCredentialsProvider; #$credentialsProvider->addCredentials($username, $password); #my $page = $webClient->getPage( "http://htmlunit.sourceforge.net",); #print $page->getTitleText(); Thanks! Jim Please visit our website for important disclaimers/disclosures regarding Knight’s products and services: http://knight.com/KnightEmailDisclaimer.html
Subject: Re: [rt.cpan.org #73535] no proxy settings..
Date: Wed, 28 Dec 2011 11:12:55 -0500
To: "Zhang, Zhengquan via RT" <bug-WWW-HtmlUnit [...] rt.cpan.org>
From: Brock <awwaiid [...] thelackthereof.org>
On 2011.12.28.11.01, Zhang, Zhengquan via RT wrote: Show quoted text
> here my test.pl: > > use strict; > use warnings; > > use WWW::HtmlUnit; > use Inline::Java qw(study_classes); > > study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], 'WWW::HtmlUnit'); > > my $proxy_config = > WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( > 'http://statarb:sT4tArB@jc1prxy2', > 8080, > );
Took a gander at the internet docs for HtmlUnit, and was surprised that the 'http://' part actually looks valid (I thought you didn't need it). I think you can set the user/password like this, but I'm not sure: my $credentials = $webClient->getCredentialsProvider; $credentials->addProxyCredentials($username, $password); Show quoted text
> my $webClient = WWW::HtmlUnit->new; > webClient->setProxyConfig($proxy_config);
This won't compile because it should be: $webClient->setProxyConfig($proxy_config); (I forgot the '$' :) ). I tested this and it at least compiles now, though I don't have a proxy set up to actually test beyond that. See if that helps, --Brock
Subject: Re: [rt.cpan.org #73535] no proxy settings..
Date: Wed, 28 Dec 2011 11:26:03 -0500
To: Brock Wilcox via RT <bug-WWW-HtmlUnit [...] rt.cpan.org>
From: "Zhang, Zhengquan" <zhzhang [...] knight.com>
-- Zhengquan Zhang, group: 201.557.6880 work: 201.239.2238 Electronic Trading Group Knight Capital Americas L.P. On Wed, Dec 28, 2011 at 11:14:00AM -0500, Brock Wilcox via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73535 > > > > > On 2011.12.28.11.01, Zhang, Zhengquan via RT wrote:
> > here my test.pl: > > > > use strict; > > use warnings; > > > > use WWW::HtmlUnit; > > use Inline::Java qw(study_classes); > > > > study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], 'WWW::HtmlUnit'); > > > > my $proxy_config = > > WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( > > 'http://statarb:sT4tArB@jc1prxy2', > > 8080, > > );
> > Took a gander at the internet docs for HtmlUnit, and was surprised that > the 'http://' part actually looks valid (I thought you didn't need it). > I think you can set the user/password like this, but I'm not sure: > > my $credentials = $webClient->getCredentialsProvider; > $credentials->addProxyCredentials($username, $password); >
> > my $webClient = WWW::HtmlUnit->new; > > webClient->setProxyConfig($proxy_config);
> > This won't compile because it should be: > > $webClient->setProxyConfig($proxy_config); > > (I forgot the '$' :) ). I tested this and it at least compiles now, > though I don't have a proxy set up to actually test beyond that.
stupid me missed the $ as well:) now I get another compile error in setting the username and password. perl test.pl Global symbol "$webclient" requires explicit package name at test.pl line 39, <GEN6> line 4. Execution of test.pl aborted due to compilation errors. test.pl: use strict; use warnings; use WWW::HtmlUnit; use Inline::Java qw(study_classes); study_classes(['com.gargoylesoftware.htmlunit.ProxyConfig'], 'WWW::HtmlUnit'); my $proxy_config = WWW::HtmlUnit::com::gargoylesoftware::htmlunit::ProxyConfig->new( 'http://statarb:sT4tArB@jc1prxy2', 8080, ); my $webClient = WWW::HtmlUnit->new; $webClient->setProxyConfig($proxy_config); my ($username,$password)= ('statarb', 'sT4tArB'); my $credentialsProvider = $webclient->getCredentialsProvider(); $credentialsProvider->addProxyCredentials($username, $password); my $page = $webClient->getPage( "http://htmlunit.sourceforge.net",); print $page->getTitleText(); Thanks. Jim Please visit our website for important disclaimers/disclosures regarding Knight’s products and services: http://knight.com/KnightEmailDisclaimer.html
Show quoted text
> now I get another compile error in setting the username and password. > > perl test.pl > Global symbol "$webclient" requires explicit package name at test.pl > line 39, > <GEN6> line 4. > Execution of test.pl aborted due to compilation errors.
You've mixed "$webclient" and "$webClient" (capital 'C'). Try again :) --Brock
Subject: Re: [rt.cpan.org #73535] no proxy settings..
Date: Sun, 1 Jan 2012 15:49:08 -0500
To: Brock Wilcox via RT <bug-WWW-HtmlUnit [...] rt.cpan.org>
From: "Zhang, Zhengquan" <zhzhang [...] knight.com>
On Sat, Dec 31, 2011 at 01:17:15PM -0500, Brock Wilcox via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73535 > >
> > now I get another compile error in setting the username and password. > > > > perl test.pl > > Global symbol "$webclient" requires explicit package name at test.pl > > line 39, > > <GEN6> line 4. > > Execution of test.pl aborted due to compilation errors.
> > You've mixed "$webclient" and "$webClient" (capital 'C'). > > Try again :)
Thank you and happy new year! it works. Jim Please visit our website for important disclaimers/disclosures regarding Knight’s products and services: http://knight.com/KnightEmailDisclaimer.html