[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-110-gc9f9e9e
Ian Beckwith
ianb at erislabs.net
Wed Apr 21 19:34:13 UTC 2010
The following commit has been merged in the master branch:
commit c9ff8b69029eae1cf912b9eb4d55593cb914bfb9
Author: Ian Beckwith <ianb at erislabs.net>
Date: Wed Apr 21 20:18:18 2010 +0100
wikipedia: tweak Simone's patch to support https for start page and document the SURFRAW_wikipedia_ssl variable.
diff --git a/ChangeLog b/ChangeLog
index 796f3c7..10024ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
* New elvi: jamendo - Search Jamendo: free music with Creative
Commons licenses (www.jamendo.com). Thanks to Simone Fittabile.
* wikipedia, ixquick: Support https. Thanks to Simone Fittabile.
+ * wikipedia: tweak Simone's patch to support https for start
+ page and document the SURFRAW_wikipedia_ssl variable.
2010-04-19 James Rowe <jnrowe at gmail.com>
diff --git a/elvi/wikipedia b/elvi/wikipedia
index 59ae151..a13ee88 100755
--- a/elvi/wikipedia
+++ b/elvi/wikipedia
@@ -6,6 +6,8 @@
w3_config_hook () {
def SURFRAW_wikipedia_language "$SURFRAW_lang"
+# default to off until we know the ssl site is going to stick around
+defyn SURFRAW_wikipedia_ssl no
}
w3_usage_hook () {
@@ -15,6 +17,7 @@ Description:
Search the Wikipedia online encyclopedia
Local options:
-s Uses experimental HTTPS secure connection.
+ Environment: SURFRAW_wikipedia_ssl
-language=ISOCODE | -l=ISOCODE Two letter language code (resembles ISO country codes)
Default: en
Environment: SURFRAW_wikipedia_language, SURFRAW_lang
@@ -31,7 +34,7 @@ w3_parse_option_hook () {
case "$opt" in
-language=*) setopt SURFRAW_wikipedia_language $optarg ;;
-l=*) setopt SURFRAW_wikipedia_language $optarg ;;
- -s*) setopt SURFRAW_wikipedia_https $optarg ;;
+ -s*) setoptyn SURFRAW_wikipedia_ssl yes ;;
*) return 1 ;;
esac
return 0
@@ -51,12 +54,16 @@ prefixs="https://secure.wikimedia.org/wikipedia/${SURFRAW_wikipedia_language}/w/
suffix="&go=Go"
if null "$w3_args"; then
- w3_browse_url "http://${SURFRAW_wikipedia_language}.wikipedia.org"
+ if ifyes SURFRAW_wikipedia_ssl ; then
+ w3_browse_url "https://secure.wikimedia.org/wikipedia/${SURFRAW_wikipedia_language}/wiki/Main_Page"
+ else
+ w3_browse_url "http://${SURFRAW_wikipedia_language}.wikipedia.org"
+ fi
else
escaped_args=`w3_url_of_arg $w3_args`
- if [ -z "$SURFRAW_wikipedia_https" ]; then
- w3_browse_url "${prefixs}${escaped_args}"
+ if ifyes SURFRAW_wikipedia_ssl ; then
+ w3_browse_url "${prefixs}${escaped_args}"
else
- w3_browse_url "${prefix}${escaped_args}${suffix}"
+ w3_browse_url "${prefix}${escaped_args}${suffix}"
fi
fi
--
surfraw - a fast unix command line interface to WWW
More information about the Surfraw-commits
mailing list