magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1999 > 02 > Programming with Perl

Preforking and Compressing Proxy

Back in my February 1997 column, I wrote an anonymizing proxy server in roughly 100 lines of Perl code. You could configure your browser to use the proxy, and the servers at the sites you visit wouldn't be able to discern your real IP address or other telltale identifying information (like cookies). The downside of this tiny proxy server was that every fetched URL caused a process to be forked.

If a real Web server were to do that, it'd probably be fairly narrow in application, so most modern Web servers perform preforking. That is, they fork a number of server processes ready to respond to an incoming request. Then as the requests come in, there's no latency from the time it takes to fork and get ready to listen.

Perl has enough tools to do this as well, so I decided to rewrite that proxy server as a preforking server. That alone would make it cool enough for a new column here, but I went one item better.

Most modern Web browsers accept compressed data (most commonly in the gzip format), automatically uncompressing it to display to the user. Because text compresses very well (especially large HTML pages), we can make the proxy server automatically detect a gzip-savvy browser, and compress all text downloads on the fly!

That way, if I'm running the proxy server on a machine with good Net connections (like a T-1 or better), I can use it as a speed-enhancing proxy on my normal modem links. And in fact, in practice, I found it to make downloading noticeably zippier.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2