From ca0d2e0882b48f652f102b0a581f2c9051e64cad Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 31 Aug 2016 22:25:19 +0400 Subject: [PATCH] =?UTF-8?q?pr=C3=A9parer=20le=20support=20de=20%n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/runsmod | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ulib/runsmod b/lib/ulib/runsmod index ee5f1f5..9d83eca 100644 --- a/lib/ulib/runsmod +++ b/lib/ulib/runsmod @@ -338,14 +338,25 @@ function __runsmod_has_vmodule() { [ "${1//%m/}" != "$1" ] } function __runsmod_has_vhost() { + # tester si l'url $1 contient une variable d'hôte %h ou %n + [ "${1//%h/}" != "$1" -o "${1//%n/}" != "$1" ] +} +function __runsmod_has_vhost_strict() { # tester si l'url $1 contient une variable d'hôte %h [ "${1//%h/}" != "$1" ] } +function __runsmod_has_vhost_generic() { + # tester si l'url $1 contient une variable d'hôte %n + [ "${1//%n/}" != "$1" ] +} function __runsmod_replace1() { # remplacer dans l'url $1 la variable %h par l'hôte complet $2 et # éventuellement la variable %m par le module $3 local url="$1" + local hostname domain + splithost "$2" hostname domain [ -n "$2" ] && url="${url//%h/$2}" + [ -n "$2" ] && url="${url//%n/$hostname*$domain}" [ -n "$3" ] && url="${url//%m/$3}" echo "$url" } @@ -355,6 +366,7 @@ function __runsmod_replace2() { local url="$1" local host="${2%%.*}" [ -n "$host" ] && url="${url//%h/$host}" + [ -n "$host" ] && url="${url//%n/$host*}" [ -n "$3" ] && url="${url//%m/$3}" echo "$url" }