[Surfraw-devel] Make elvi/aur use https by default

Ivy Foster joyfulgirl at archlinux.us
Tue Jan 10 18:59:11 UTC 2012


Howdy, folks,

I've included a minor patch. A while back, Arch Linux's AUR
disabled being logged in while visiting the site via http
rather than https. Therefore, it seemed to me that surfraw
ought to send an https uri by default, with the option to
turn that off if (for some reason) that proved necessary.
And lo, a trivial patch was born.

Enjoy!

Ivy
-------------- next part --------------
>From 1531bef83538cd54f8df7f8900d457b0aeeda844 Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl at archlinux.us>
Date: Tue, 10 Jan 2012 13:50:47 -0500
Subject: [PATCH] elvi/aur now uses HTTPS by default.

    - On the AUR, connecting via HTTP disables login.
    - Added switch -no-https to enable connection via plain HTTP
---
 elvi/aur |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/elvi/aur b/elvi/aur
index 77a2ee3..b51c4c9 100755
--- a/elvi/aur
+++ b/elvi/aur
@@ -14,6 +14,7 @@ w3_config_hook () {
     def   SURFRAW_aur_order    "a"
     def   SURFRAW_aur_language en
     defyn SURFRAW_aur_outdated 0
+    def   SURFRAW_aur_protocol "https"
     def   SURFRAW_aur_results  "$SURFRAW_results"
     def   SURFRAW_aur_search   name
     def   SURFRAW_aur_sort     name
@@ -32,6 +33,9 @@ Local options
   -language                     Search in your your language
                                 See aur.archlinux.org for available languages
                                 Default: en
+  -no-https                     Connect using HTTP, rather than HTTPS.
+                                This disables logging in.
+                                Default: use $SURFRAW_aur_protocol
   -order=ascending|descending   Organize in ascending or descending order
                                 Default: ascending
   -orphans                      Search orphaned packages
@@ -62,6 +66,7 @@ w3_parse_option_hook () {
     case "$opt" in
         -category=*) setopt   SURFRAW_aur_category "$optarg" ;;
         -language=*) setopt   SURFRAW_aur_language "$optarg" ;;
+        -no-https)   setopt   SURFRAW_aur_protocol "http" ;;
         -orphans*)   setopt   SURFRAW_aur_action   "Orphans=Orphans" ;;
         -order=d*)   setopt   SURFRAW_aur_order    d ;;
         -order=*)    setopt   SURFRAW_aur_order    a ;;
@@ -130,12 +135,12 @@ esac
 
 # w3_args now contains a list of arguments
 if test -z "$w3_args" && test "$SURFRAW_aur_action" = "Search=Go"; then
-    w3_browse_url "http://aur.archlinux.org/packages.php?setlang=${aur_lang}"
+    w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?setlang=${aur_lang}"
 else
     escaped_args=`w3_url_of_arg $w3_args`
     if [ "$SURFRAW_aur_outdated" = 1 ]; then
-        w3_browse_url "http://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&outdated=on&setlang=${aur_lang}"
+        w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&outdated=on&setlang=${aur_lang}"
     else
-        w3_browse_url "http://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&setlang=${aur_lang}"
+        w3_browse_url "${SURFRAW_aur_protocol}://aur.archlinux.org/packages.php?O=0&L=0&detail=1&C=${aur_category}&K=${escaped_args}&SeB=${aur_search_by}&SB=${aur_sort_by}&SO=${SURFRAW_aur_order}&PP=${SURFRAW_aur_results}&do_${SURFRAW_aur_action}&setlang=${aur_lang}"
     fi
 fi
-- 
1.7.8.3



More information about the Surfraw-devel mailing list