#!/usr/bin/perl
#
# CGIProxy 2.1beta15
#
# nph-proxy.cgi-- CGIProxy 2.1: a proxy in the form of a CGI script.
# Retrieves the resource at any HTTP or FTP URL, updating embedded URLs
# in HTML and other resources to point back through this script. By
# default, no user info is sent to the server. Options include
# text-only proxying to save bandwidth, cookie filtering, ad filtering,
# script removal, user-defined encoding of the target URL, and more.
# Requires Perl 5.
#
# Copyright (C) 1996, 1998-2006 by James Marshall, james@jmarshall.com
# All rights reserved. Free for non-commercial use; commercial use
# requires a license.
#
# For the latest, see http://www.jmarshall.com/tools/cgiproxy/
#
#
# IMPORTANT NOTE ABOUT ANONYMOUS BROWSING:
# CGIProxy was originally made for indirect browsing more than
# anonymity, but since people are using it for anonymity, I've tried
# to make it as anonymous as possible. Suggestions welcome. For best
# anonymity, browse with JavaScript turned off. In fact, that's the
# only reliable way, in spite of what certain anonymity vendors claim.
# That said, please notify me if you find any privacy holes, even when
# using JavaScript.
# Anonymity is good, but may not be bulletproof. For example, if even
# a single unchecked JavaScript statement can be run, your anonymity
# can be compromised. I've tried to handle JS in every place it can
# exist, but please tell me if I missed any. Also, browser plugins
# or other executable extensions may be able to reveal you to a server.
# Also, be aware that this script doesn't modify PDF files or other
# third-party document formats that may contain linking ability, so
# you will lose your anonymity if you follow links in such files.
# If you find any other way your anonymity can be compromised, please let
# me know.
#
#
# CONFIGURATION:
#
# None required in most situations. On some servers, these might be
# required (all in the "user configuration" section):
# . If you're using another HTTP or SSL proxy, set $HTTP_PROXY,
# $SSL_PROXY, and $NO_PROXY as needed. If those proxies use
# authentication, set $PROXY_AUTH and $SSL_PROXY_AUTH accordingly.
# . If this is running on an SSL server that doesn't use port 443, set
# $RUNNING_ON_SSL_SERVER=1 (otherwise, the default of '' is fine).
#
# Options include:
# . Set $TEXT_ONLY, $REMOVE_COOKIES, $REMOVE_SCRIPTS, $FILTER_ADS,
# $HIDE_REFERER, and $INSERT_ENTRY_FORM as desired. Set
# $REMOVE_SCRIPTS if anonymity is important.
# . To let the user choose all of those settings (except $TEXT_ONLY),
# set $ALLOW_USER_CONFIG=1.
# . To change the encoding format of the URL, modify the
# proxy_encode() and proxy_decode() routines. The default
# routines are suitable for simple PATH_INFO compliance.
# . To encode cookies, modify the cookie_encode() and cookie_decode()
# routines.
# . You can restrict which servers this proxy will access, with
# @ALLOWED_SERVERS and @BANNED_SERVERS.
# . Similarly, you can specify allowed and denied server lists for
# both cookies and scripts.
# . For security, you can ban access to private IP ranges, with
# @BANNED_NETWORKS.
# . If filtering ads, you can customize this with a few settings.
# . To insert your own block of HTML into each page, set $INSERT_HTML
# or $INSERT_FILE.
# . As a last resort, if you really can't run this script as NPH,
# you can try to run it as non-NPH by setting $NOT_RUNNING_AS_NPH=1.
# BUT, read the notes and warnings above that line. Caveat surfor.
# . For crude load-balancing among a set of proxies, set @PROXY_GROUP.
# . Other config is possible; see the user configuration section.
# . If heavy use of this proxy puts a load on your server, see the
# "NOTES ON PERFORMANCE" section below.
#
# For more info, read the comments regarding any config options you set.
#
# This script MUST be installed as a non-parsed header (NPH) script.
# In Apache and many other servers, this is done by simply starting the
# filename with "nph-". It MAY be possible to fake it as a non-NPH
# script, MOST of the time, by using the $NOT_RUNNING_AS_NPH feature.
# This is not advised. See the comments by that option for warnings.
#
#
# TO USE:
# Start a browsing session by calling the script with no parameters.
# You can bookmark pages you browse to through the proxy, or link to
# the URLs that are generated.
#
#
# NOTES ON PERFORMANCE:
# Unfortunately, this has gotten slower through the versions, mostly
# because of optional new features. Configured equally, version 1.3
# takes 25% longer to run than 1.0 or 1.1 (based on *cough* highly
# abbreviated testing). Compiling takes about 50% longer.
# Leaving $REMOVE_SCRIPTS=1 adds 25-50% to the running time.
# Remember that we're talking about tenths of a second here. Most of
# the delay experienced by the user is from waiting on two network
=1= |