#
# File : $Source: /cvsroot/ijbswa/current/default.filter,v $
#
-# $Id: default.filter,v 1.25 2006/10/06 15:26:09 fabiankeil Exp $
+# $Id: default.filter,v 1.30 2006/10/18 12:36:50 fabiankeil Exp $
#
# Purpose : Rules to process the content of web pages
#
# The status bar is for displaying link targets, not pointless blahblah
#
-s/(\W\s*)((this|window)\.(default)?status)\s*=\s*((['"]).*?\6)/$1if(typeof(this.href) != 'undefined') $2 = $5 + ' URL: ' + this.href;else return false/ig
+s/(\W\s*)((this|window)\.(default)?status)\s*=\s*((['"]).*?(?<!\\)\6)/$1if(typeof(this.href) != 'undefined') $2 = $5 + ' URL: ' + this.href;else return false/ig
# Kill OnUnload popups. Yummy.
# Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
s|<img\s+?([^>]*) src\s*=\s*(['"])([^>\\\2]+)\2|<img src=$2$3$2 $1|siUg
s|<img\s+?([^>]*) src\s*=\s*([^'">\\\s]+)|<img src=$2 $1|sig
-s|<img (src=(?:(['"])[^>\\\\2]*\2\|[^'">\\\s]+?))([^>]*)\s*width\s*=\s*(["']?)(\d+?)\4|<img $1 width=$4$5$4$3|siUg
+s|<img (src=(?:(['"])[^>\\\\2]*\2\|[^'">\\\s]+?))([^>]*)\s+width\s*=\s*(["']?)(\d+?)\4|<img $1 width=$4$5$4$3|siUg
#################################################################################
#################################################################################
FILTER: webbugs Squish WebBugs (1x1 invisible GIFs used for user tracking)
-s/<img\s+[^>]*(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*?>//siUg
+s@<img[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*\s(?:width|height)\s*=\s*['"]?[01](?=\D)[^>]*?>@<!--\
+ Filtered by Privoxy's webbugs filter: $0 -->@siUg
#################################################################################
#################################################################################
FILTER: jumping-windows Prevent windows from resizing and moving themselves
-s/(?:window|this|self)\.(?:move|resize)(?:to|by)\(/''.concat(/ig
-
+s/(?<=[\W])(?:window|this|self)\.(?:move|resize)(?:to|by)\(/''.concat(/ig
#################################################################################
#
s|(<INPUT name="\d{2,4}" type="RADIO" value="0") CHECKED |$1|g
s|<INPUT name="\d{2,4}" type="RADIO" value="3" |$0 checked|g
+#################################################################################
+#
+# no-ping: Removes non-standard ping attributes in <a> and <area> tags.
+#
+#################################################################################
+FILTER: no-ping Removes non-standard ping attributes in <a> and <area> tags.
+s@(<a(?:rea)?[^>]*?)ping=(['"]?)([^"'>]+)\2([>\s]?)@\
+<strong title="Privoxy removed ping target '$3'">PING!</strong>\n$1$4@ig
+
#################################################################################
#
# google: CSS-based block for Google text ads. Also removes
s@</head>@<style type="text/css">\n\
/* Style sheet inserted by Privoxy's google filter. */\n\
\#fbc, \#fbl, \#ra, .rhh {visibility: hidden !important;}\n\
- \#tpa1,\#tpa2,\#tpa3,\#tpa4,\#tpa5,\#tpa5, \#spl, .ch, \#ads, \#toolbar, \#google_ads_frame{display: none !important;}\n\
+ \#tpa1,\#tpa2,\#tpa3,\#tpa4,\#tpa5,\#tpa5, \#spl, .ch, \#ads,\
+ \#toolbar, \#google_ads_frame{display: none !important;}\n\
.main_body, .j {width: 100%}\n</style>\n$0@
s@<div style=\"padding-top:11px;min-width:500px\">@<div id="main_body">@
s@(<table cellspacing=0 cellpadding=0 width=25% align=right bgcolor=\#ffffff border=0\
|</font></td></tr></tbody></table><table align=\"right\" bgcolor=\"\#ffffff\"\
-|<table cellspacing=0 cellpadding=0 align=right bgcolor=\#ffffff border=0)@$0 id="ads"@
+|<table cellspacing=0 cellpadding=0 align=right bgcolor=\#ffffff border=0\
+|<table style=\"clear:both\" align=right width=25% cellspacing=\"0\" cellpadding=\"0\"\
+ border=\"0\" bgcolor=\"\#ffffff\")@$0 id="ads"@
s@(<br clear=all><table)( border=0 cellpadding=9><tr><td)@$1 id="toolbar"$2@
#################################################################################
\#sidebar {width: 29% }\n\
.post-body {overflow: auto;}\n\
.blogComments {width: 100%; overflow: auto;}\n</style>\n$0@
-s@<body.*(<div id="(content|wrap4|wrapper))@<body><!-- Privoxy's\
- blogspot filter ditched some garbage here -->$1@Us
+s@<body.*(?:<div id="space-for-ie"></div>|(<div id="(?:content|wrap4|wrapper)))@<body>\
+ <!-- Privoxy's blogspot filter ditched some garbage here -->$1@Us
s@(<div style=\"[^\"]*width:)30em@$1 100%@
s@background:url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;@/*$0*/@Ug
s@(background:\#[a-f\d]{3})( url\(\"http://www.blogblog.com/rounders[^\"]*\"\).*;)@$1 ;/*$2*/@Ug
FILTER: xml-to-html Header filter to change the Content-Type from xml to html.
s@^(Content-Type:) (?:application|text)/(?:xhtml\+)?xml(;.*)?$@$1 text/html$2@
+#################################################################################
+#
+# hide-tor-exit-notation: Header filter to remove the Tor exit node notation
+# in Host and Referer headers.
+#
+# Note: If Privoxy and Tor are chained and Privoxy is configured to
+# use socks4a, one can use http://www.example.org.foobar.exit/
+# to access the host www.example.org through Tor exit node foobar.
+#
+# As the HTTP client isn't aware of this notation, it treats the
+# whole string "www.example.org.foobar.exit" as host and uses it
+# for the "Host" and "Referer" headers. From the server's point of
+# view the resulting headers are invalid and can cause problems.
+#
+# An invalid "Referer" header can trigger "hot-linking" protections,
+# an invalid "Host" header will make it impossible for the server to
+# find the right vhost (several domains hosted on the same IP address).
+#
+# This filter removes the "foo.exit" part in those headers
+# to prevent the mentioned problems. Note that it only modifies
+# the HTTP headers, it doesn't make it impossible for the server
+# to detect your Tor exit node based on the IP address the request is
+# coming from.
+#
+#################################################################################
+FILTER: hide-tor-exit-notation Header filter to remove the Tor exit node notation in Host and Referer headers.
+s@^((?:Referer|Host):\s*(?:https?://)?[^/]*)\.[^\./]*?\.exit@$1@i
+
+
##############################################################################
#
# Revisions :
# $Log: default.filter,v $
+# Revision 1.30 2006/10/18 12:36:50 fabiankeil
+# google filter now cleans Google groups as well.
+#
+# Revision 1.29 2006/10/11 14:03:17 fabiankeil
+# Changed img-reorder regex to only move width
+# attributes if they are following at least one
+# whitespace. Fixes BR 1328455.
+#
+# Revision 1.28 2006/10/11 13:31:13 fabiankeil
+# Added Anduin Withers' js-annoyances fix
+# for not messing up escaped quotes. Fixes BR 999765.
+#
+# Improved blogspot filter to make it less likely that
+# the blogspot banner at the top of the page is missed.
+#
+# Revision 1.27 2006/10/08 17:00:51 fabiankeil
+# Modified webbugs filter to create a comment around the offending
+# image instead of removing it entirely.
+#
+# Adjusted regex to only match if there's at least one whitespace
+# before the width and height attributes. Makes it more likely that
+# they are indeed attributes, and not part of the value of another attribute.
+# Solves BR 1035587.
+#
+# Thanks to Martin Thomas for diagnosing the cause of the problem.
+#
+# Revision 1.26 2006/10/06 18:06:16 fabiankeil
+# Added header filter x-httpd-php-to-html
+# and reverted another img-reorder whitespace
+# problem.
+#
# Revision 1.25 2006/10/06 15:26:09 fabiankeil
# Bumped copyright year.
#