[HTTPS-E Rulesets] [PATCH] make-trivial-rule: Support target domains other than www.
Josh Triplett
josh at joshtriplett.org
Sun Aug 21 15:09:23 PDT 2011
Many sites prefer to redirect *away* from www, rather than towards it.
In addition, some sites use a different domain entirely for secure
content. Add an optional second parameter to make-trivial-rule,
specifying the domain to redirect to.
---
Available either by "git am"ing this mail or by pulling from
git://joshtriplett.org/git/https-everywhere .
src/chrome/content/rules/make-trivial-rule | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/chrome/content/rules/make-trivial-rule b/src/chrome/content/rules/make-trivial-rule
index e50eb09..542f1a2 100755
--- a/src/chrome/content/rules/make-trivial-rule
+++ b/src/chrome/content/rules/make-trivial-rule
@@ -3,11 +3,12 @@
# THIS IS NOT A RULE, but a shell script to create simple rules for a
# specified domain.
#
-# create $1.xml, mapping $1 and www.$1 to https://www.$1
+# create $1.xml, mapping $1 and www.$1 to https://$2 (or https://www.$1 by
+# default)
if [ -z "$1" ]
then
- echo "syntax: $0 example.com" >&2
+ echo "syntax: $0 example.com [secure.example.com]" >&2
exit 1
fi
@@ -33,13 +34,18 @@ fi
lower=$(echo "$1" | tr A-Z a-z)
escaped=$(echo "$lower" | sed 's/\./\\./g' )
+if [ "$#" -gt 1 ] ; then
+ to="$2"
+else
+ to="www.$lower"
+fi
cat > "$dest" <<END
<ruleset name="$capitalized">
<target host="$lower" />
<target host="www.$lower" />
- <rule from="^http://(www\.)?$escaped/" to="https://www.$lower/" />
+ <rule from="^http://(www\.)?$escaped/" to="https://$to/" />
</ruleset>
END
--
1.7.5.4
More information about the HTTPS-Everywhere-Rules
mailing list