]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add concurrent support to shell re-writer
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 24 Aug 2009 10:00:48 +0000 (22:00 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 24 Aug 2009 10:00:48 +0000 (22:00 +1200)
helpers/url_rewrite/fake/url_fake_rewrite.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index bcfdf26..7e00d90
@@ -7,22 +7,38 @@
 # squid under the same conditions as the main squid application.
 #
 
-if test "${1}" = "-d" ; then
-       echo "Usage: $0 [-h] [-d logfile]"
+if test "${1}" = "-h" ; then
+       echo "Usage: $0 [-h] [-c] [-d logfile]"
        echo "  -h           Help: this help text"
+       echo "  -c           Accept concurrent request format"
        echo "  -d logfile   Debug: log all data received to the named file"
        exit 1
 fi
 
+concurrent=0
+if test "${1}" = "-c" ; then
+       concurrent=1
+       shift
+fi
+
 DEBUG=0
 if test "${1}" = "-d" ; then
        DEBUG=1
        LOG="${2}"
 fi
 
-while read url rest; do
-       if test ${DEBUG} ; then
-               echo "$url $rest" >>${LOG}
-       fi
-       echo  # blank line for no change, or replace with another URL.
-done
+if test "$concurrent" = "1"; then
+       while read id url rest; do
+               if test ${DEBUG} ; then
+                       echo "ID:$id URL:$url EXTRAS:$rest" >>${LOG}
+               fi
+               echo "${id} " # blank URL for no change, or replace with another URL.
+       done
+else
+       while read url rest; do
+               if test ${DEBUG} ; then
+                       echo "URL:$url EXTRAS:$rest" >>${LOG}
+               fi
+               echo  # blank line/URL for no change, or replace with another URL.
+       done
+fi