See Arguile's post below (pmproxy2.0.1?) for a much more up to date/feature packed version. Or see a screenshot (1/6/2001).
You may or may not have seen this before - pmproxy, but its back and I think it's really getting somewhere :) Before I get into the details, go take a look at what I was able to achieve - pmproxy2.png.
This new version basically adds cookie and post support. In my haste I wasnt able to find a way to correctly save the cookies to the file. If anyone can help me with that I would be most greatfull.
It does still lack any form of error control, I guess I'll add to that as I come across things. But so far I havent had too many problems.
I used this stylesheet to achieve whats displayed in the above screenshot.
As you can see at the bottom of the code I have added a simple sub in which to define some substitutions and other operations to be applied to the page. This is just to clean a few things up which I couldnt override in the css.
If you want to give it a go, grab the below code, save it to something like pmproxy2.pl. Get a stylesheet, try the one linked above (place that in the same directory). Then exec the script and connect to http://localhost:99/index.pl
Let me know what you think, or if I've done something strikingly bad with the code!
open(CSS,"style.css") || die "CSS Error: $!";
my $css = join("",<CSS>);
my $ua = new LWP::UserAgent;
my $co = HTTP::Cookies->new();
Reuse => '1') || die "Cant Spawn: $!";
my $c = $d->accept;
my $r = $c->get_request();
my $url = $r->uri->as_string;
if ($url !~ /style.css$/i)
$url = "http://www.perlmonks.org$url";
if ($r->method eq "GET")
$req = new HTTP::Request GET => $url;
$req = new HTTP::Request POST => $url;
my $res = $ua->request($req);
$content = $res->content;
$content = &dosubs($content);
$content = $css;
my $response = HTTP::Response->new();
$_ = shift;
s|<body|<link rel=stylesheet type="text/css" href="/style.css" />\
####DEFINE SUBSTITUTIONS HERE####
s/(INPUT type=radio)/$1 class="noborder"/gi;
s/<font size=2/<font style="text"/gi;
In reply to pmproxy2
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||