From: Amos Jeffries Date: Mon, 24 Aug 2009 10:00:48 +0000 (+1200) Subject: Add concurrent support to shell re-writer X-Git-Tag: SQUID_3_2_0_1~741^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1db8047ab928247733e22327aaa4eb01dffe82d5;p=thirdparty%2Fsquid.git Add concurrent support to shell re-writer --- diff --git a/helpers/url_rewrite/fake/url_fake_rewrite.sh b/helpers/url_rewrite/fake/url_fake_rewrite.sh old mode 100644 new mode 100755 index bcfdf26f56..7e00d906b4 --- a/helpers/url_rewrite/fake/url_fake_rewrite.sh +++ b/helpers/url_rewrite/fake/url_fake_rewrite.sh @@ -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