Proxy in perl

Discussion in 'Perl Misc' started by secSwami, Oct 2, 2008.

  1. secSwami

    secSwami Guest

    Thanks Tim and Martein for your reponses on this. Here is what I am
    doing to setup a simple proxy on my box localy using HTTP::proxy module.


    #!/usr/bin/perl
    use HTTP::proxy;


    my $proxy=HTTP::proxy->new (port => 3128);

    $proxy->start;


    Just these 4 lines starts up the proxy server on my local machine
    listening on port 3128 and then I point my browser's proxy setting to
    "localhost" and port "3128". This all works great. No issues there.

    However, I would like to see the URL that the user just typed in the
    broswer and then take the URL and see if another upstream server app
    thinks its blocked or not (a central server) and if the central server
    returns a block then spit that out to the users browser. How can I
    intercept the user request? and see what that request was in the code above.

    Thanks a bunch guys. Really appreciate it.
     
    secSwami, Oct 2, 2008
    #1
    1. Advertising

  2. secSwami

    Ben Morrow Guest

    Quoth secSwami <>:
    > Thanks Tim and Martein for your reponses on this. Here is what I am
    > doing to setup a simple proxy on my box localy using HTTP::proxy module.
    >
    > #!/usr/bin/perl
    > use HTTP::proxy;
    >
    >
    > my $proxy=HTTP::proxy->new (port => 3128);
    >
    > $proxy->start;
    >
    >
    > Just these 4 lines starts up the proxy server on my local machine
    > listening on port 3128 and then I point my browser's proxy setting to
    > "localhost" and port "3128". This all works great. No issues there.
    >
    > However, I would like to see the URL that the user just typed in the
    > broswer and then take the URL and see if another upstream server app
    > thinks its blocked or not (a central server) and if the central server
    > returns a block then spit that out to the users browser. How can I
    > intercept the user request? and see what that request was in the code above.


    You need to use the ->push_filter method on the proxy object before you
    call ->start. See the documentation for HTTP::proxy.

    Ben

    --
    You poor take courage, you rich take care:
    The Earth was made a common treasury for everyone to share
    All things in common, all people one.
    'We come in peace'---the order came to cut them down. []
     
    Ben Morrow, Oct 3, 2008
    #2
    1. Advertising

  3. secSwami

    secSwami Guest

    Ben Morrow wrote:
    > Quoth secSwami <>:
    >> Thanks Tim and Martein for your reponses on this. Here is what I am
    >> doing to setup a simple proxy on my box localy using HTTP::proxy module.
    >>
    >> #!/usr/bin/perl
    >> use HTTP::proxy;
    >>
    >>
    >> my $proxy=HTTP::proxy->new (port => 3128);
    >>
    >> $proxy->start;
    >>
    >>
    >> Just these 4 lines starts up the proxy server on my local machine
    >> listening on port 3128 and then I point my browser's proxy setting to
    >> "localhost" and port "3128". This all works great. No issues there.
    >>
    >> However, I would like to see the URL that the user just typed in the
    >> broswer and then take the URL and see if another upstream server app
    >> thinks its blocked or not (a central server) and if the central server
    >> returns a block then spit that out to the users browser. How can I
    >> intercept the user request? and see what that request was in the code above.

    >
    > You need to use the ->push_filter method on the proxy object before you
    > call ->start. See the documentation for HTTP::proxy.
    >
    > Ben
    >


    Thanks Ben. I will give it a shot.
     
    secSwami, Oct 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    918
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,666
  3. Karsten Wutzke
    Replies:
    1
    Views:
    917
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    621
    Steve Holden
    Dec 20, 2009
  5. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    164
    Alejandro Molina
    Jul 15, 2004
Loading...

Share This Page