[Filterproxy-devel] New module for FilterProxy
Brought to you by:
mcelrath
From: John F W. <way...@wp...> - 2001-08-03 18:51:12
|
Ok, so, I read the slashdot article about popups, and decided I was once and for all pissed off enough about ads to do something, so I searched around for a decent html rewriting proxy for linux. Yours seems to be the best one I've found, and, BONUS!, it's for PERL! So, I checked it out, and must say I'm impressed by its out-of-the-box ability to block a ton of stuff. But I'm a website designer, and I can see a need to access the original source of a document, including content that would otherwise have been rewritten/removed. I hacked together Source.pm as a rudiimentary way to view the original source of a file. The basic gist of it is that urls targetted at the fake host "source" get snagged and their content-type is set to text/plain (yes, I'm a cheapass). To get it working, bring in the module in FilterProxy.pl, and add a filter rule for all urls looking like this: http://source/?http://foobar.com/document I allowed any amount of /'s after the source, including none, just in case. It occurs to me that maybe I should use http://source/URL to fully fall within the guidelines for a correct URI (avoid having two ?'s for GET documents). Ah well, another version. Anyway, I point the filter rule at Source, and also turn off every other filter (maybe I should leave Headers). To make usage easier, I created a bookmark (in the Mozilla Personal Toolbar) of javascript:window.open("http://source/?" + document.location);, to allow easy source viewing. For now, well, it works, sorta. I seem to get some HTTP cruft at the top and bottom, (like a 0 at the end?) and, in mozilla, the connection doesn't seem to want to close... ideas? This is a major hack. I'm mostly sending it to you to get the idea out in the open. I left the version as 0.01 on purpose ;) I'm thinking in the future that I could actually return an HTML document, escaping all of the HTML, and prettifying it with syntax hilighting using <font> tags for color. That might also avoid the problems above. However, I'm not sure I'll be able to do much more work on this in the near future, because I'm dealing with RSI problems. I'm pleased to have gotten this to work thus far :) Anyway, I hope you like my meager contribution to your project, and if you feel it's actually worth distributing, feel free to modify it and/or add it to your project, it's GPL'd. And thanks for a very useful program :) |