From 1db8047ab928247733e22327aaa4eb01dffe82d5 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 24 Aug 2009 22:00:48 +1200 Subject: [PATCH] Add concurrent support to shell re-writer --- helpers/url_rewrite/fake/url_fake_rewrite.sh | 32 +++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) mode change 100644 => 100755 helpers/url_rewrite/fake/url_fake_rewrite.sh 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 -- 2.47.2