perl, WWW::Mechanize::Shell and a proxy
am 08.04.2006 14:09:33 von DaCrowhiho!
i'm trying to use the WWW::Mechanize::Shell with a proxy. i have a debian
sarge system and installed a proxy called "privoxy" for filtering ads etc..
i read in the internet, that i need to set a environment-variable because
the WWW::Mechanize::Shell looks in /etc/environment for an entry named
HTTP_PROXY=. so i set this entry via "export
HTTP_PROXY=http://127.0.0.1:8118" which is the adress of my local proxy.
when i start the WWW::Mechanize::Shell it can't find any url or website if
i try to... look what is happening:
>get http://www.google.de
Retrieving http://www.google.de(500)
>content
500 Chunked must be last Transfer-Encoding 'identity'
if i remove the entry in the /etc/environment, everything works fine.... but
i need to run a perl-script over my proxy, so what am i doing wrong??
i also try to use a small script:
#!/usr/bin/perl -w
use strict;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use URI::URL;
my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
#$agent->env_proxy();
$agent->proxy(['http', 'https'], 'http://127.0.0.1:8118');
$agent->get('http://www.google.de');
$agent->form(1) if $agent->forms and scalar @{$agent->forms};
print $agent->content,"\n";
it should just prints out the received data from google.de.. but the
error-message is the same:
Error GETing http://www.google.de:
Chunked must be last Transfer-Encoding 'identity' at ip-test.pl line 14
as you can see above, i tried it in two different ways:
first i used $agent->env_proxy(); to get the proxy-setting from the
/etc/environment...
then i tried to specify the proxy directly: $agent->proxy(['http', 'https'],
'http://127.0.0.1:8118');
same error-msg as above....
does someone has a hint for me, what i'm doing wrong or what i have to do to
set up my system in a way that the *.pl-scripts work??
thx