Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

HTTP::Proxy usage question

by chiburashka (Initiate)
on Jul 08, 2004 at 17:48 UTC ( [id://372880]=perlquestion: print w/replies, xml ) Need Help??

chiburashka has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: HTTP::Proxy usage question
by davidj (Priest) on Jul 08, 2004 at 18:19 UTC
    I'm sorry, but this script did NOT work yesterday. If this was the script that was run, then it has been changed. In the script you post you never use HTTP::proxy::HeaderFilter::simple;

    The simple addition of that line will make it work. See the difference:
    Your version

    #!/usr/bin/perl use HTTP::proxy; my $proxy = HTTP::Proxy->new; $proxy->push_filter( mime => undef, request => HTTP::Proxy::HeaderFilter::simple->new( sub { $_[0]->remove_header(qw( User-Agent From Referer Coo +kie )) }, ), response => HTTP::Proxy::HeaderFilter::simple->new( sub { $_[0]->remove_header(qw( Set-Cookie )); }, ) ); C:\tmp>ht.pl C:\tmp>ht.pl Can't locate object method "new" via package "HTTP::Proxy::HeaderFilte +r::simple" (perhaps you forgot to load "HTTP::Proxy::HeaderFilter::simple"?) at +C:\tmp\ht. pl line 14.
    Now, using the use statement
    #!/usr/bin/perl use HTTP::proxy; use HTTP::proxy::HeaderFilter::simple; # added use statement my $proxy = HTTP::Proxy->new; $proxy->push_filter( mime => undef, request => HTTP::Proxy::HeaderFilter::simple->new( sub { $_[0]->remove_header(qw( User-Agent From Referer Coo +kie )) }, ), response => HTTP::Proxy::HeaderFilter::simple->new( sub { $_[0]->remove_header(qw( Set-Cookie )); }, ) ); C:\tmp>ht.pl C:\tmp>
    And what do you know, it works!

    I know you aren't going to listen to this because others have said the same thing and you haven't listened to them, but you really do need to make the effort to learn how to debug program and research your own issues. You show no effort that you have researched any of the posts you make. If that is how you want to proceed and others want to continue assisting you, that is fine. But as for me, this is the last assistance I will give until I see that you have made an effort to solve the problem yourself before you post.

    davidj
Re: HTTP::Proxy usage question
by dragonchild (Archbishop) on Jul 08, 2004 at 18:04 UTC
    What changed? If the Perl script didn't change, something else did. I'm going to guess that you're either on a different machine or someone changed which perl is actually in /usr/bin/perl. Did the sysadmin upgrade your Perl?

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: HTTP::Proxy usage question
by ysth (Canon) on Jul 08, 2004 at 18:10 UTC
    What did you change since yesterday? Did you try adding
    use HTTP::Proxy::HeaderFilter::simple;
    ?

    By the way, could you please work on making your titles say something about what you are asking?

Re: HTTP::Proxy usage question
by insaniac (Friar) on Apr 08, 2005 at 13:18 UTC
    uhm... nobody saw it i think, but, the request and response filters should be accessing $_[1] instead of $_[0] ;-)

    but yeah, in the HTTP::Proxy pod they also say $_[0], but in their examples they use $_[1]..
    maybe this helps for future wanderers..

    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://372880]
Approved by sgifford
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-26 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found