Hi 2 all.
I have to implement the last but most important piece of my system - some proxy that will detect "bad responses" and repeat them through other parent proxy:
request -> http://example.com/stats ->
<- http://bl.com/Sorry=http://example.com/stats/ <- BAD response
Proxy must:
1. Detect: *Sorry* in URI returned in response
2. Cut off "http://bl.com/Sorry="
3. Repeat "http://example.com/stats/" through other proxy.
4. Return content to client.
I decided to try write it perl. But it just to hard to me with knowledges i have at this point.
I found HTTP::Proxy and managed to start simple proxy-example from the CPAN ( I installed LWP::UserAgent HTTP::Daemon made #export http_proxy=http://127.0.0.1:3128/)
Example:
use HTTP::Proxy;
# initialisation
my $proxy = HTTP::Proxy->new( port => 3128 );
# alternate initialisation
my $proxy = HTTP::Proxy->new;
$proxy->port( 3128 ); # the classical accessors are here!
# this is a MainLoop-like method
$proxy->start;
But how to move forward, what next? I just have no clue :(.
Thanks in advance.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.