correction d'un bug avec la construction de l'url

This commit is contained in:
Jephté Clain 2014-08-28 15:04:35 +04:00
parent ce39f910f5
commit ff14a49655
1 changed files with 8 additions and 7 deletions

View File

@ -86,6 +86,7 @@ function joinurl() {
# joindre chaque élément de $1..@ par /, en évitant les slashes en double
local i url
for i in "$@"; do
[ -n "$i" ] || continue
if [ -n "$url" ]; then
url="${url%/}/${i#/}"
else
@ -180,13 +181,13 @@ for rule in "${rules[@]}"; do
fi
usrc="$src"
trail=1
if endswith "$src" '$'; then
trail=
usrc="${src%$}"
fi
noslash=
if endswith "$suffix" '$'; then
noslash=1
@ -196,7 +197,7 @@ for rule in "${rules[@]}"; do
noslash=1
dest="${dest%$}"
fi
proxy_url=
proxy_use=
@ -205,7 +206,7 @@ for rule in "${rules[@]}"; do
if [ -n "$host" ]; then
# sur un autre hôte
if [ -n "$noslash" ]; then
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix" ${trail:+\$1}) [L${options:+,$options}]" >>"$outfile"
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$outfile"
setx url joinurl "http://$thishost" "$usrc"
setx proxy_url joinurl "$prot://$host/cgi-bin/WebObjects" "$dest" "$suffix"
else
@ -217,7 +218,7 @@ for rule in "${rules[@]}"; do
else
# sur le même hôte
if [ -n "$noslash" ]; then
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl /cgi-bin/WebObjects "$dest" "$suffix" ${trail:+\$1}) [L,P${options:+,$options}]" >>"$outfile"
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl /cgi-bin/WebObjects "$dest" "$suffix")${trail:+\$1} [L,P${options:+,$options}]" >>"$outfile"
setx url joinurl "http://$thishost" "$usrc"
setx proxy_url joinurl "$prot://$thishost/cgi-bin/WebObjects" "$dest" "$suffix"
proxy_use=1
@ -234,7 +235,7 @@ for rule in "${rules[@]}"; do
if [ -n "$host" ]; then
# sur un autre hôte
if [ -n "$noslash" ]; then
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host" "$dest" "$suffix" ${trail:+\$1}) [L${options:+,$options}]" >>"$outfile"
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl "$prot://$host" "$dest" "$suffix")${trail:+\$1} [L${options:+,$options}]" >>"$outfile"
setx url joinurl "http://$thishost" "$usrc"
setx proxy_url joinurl "$prot://$host" "$dest" "$suffix"
else
@ -246,7 +247,7 @@ for rule in "${rules[@]}"; do
else
# sur le même hôte
if [ -n "$noslash" ]; then
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl / "$dest" "$suffix" ${trail:+\$1})${options:+ [$options]}" >>"$outfile"
echo "${prefix}RewriteRule ^/$src${trail:+(.*)} $(joinurl / "$dest" "$suffix")${trail:+\$1}${options:+ [$options]}" >>"$outfile"
setx url joinurl "http://$thishost" "$usrc"
setx proxy_url joinurl "http://$thishost" "$dest" "$suffix"
else