Bug#628886: PTS: strip whitespace from pre-redirection URLs
Hi,
On Thu, 02 Jun 2011, Paul Wise wrote:
> Please apply the below patch to the PTS apache configuration to strip
> whitespace from input URLs before performing the redirects. This is
> useful when copy and pasting package names and accidentally including
> extra whitespace.
>
> --- a/apache.conf
> +++ b/apache.conf
> @@ -15,11 +15,11 @@
> RewriteEngine on
> RewriteRule ^/$ /common/index.html [L,R]
> RewriteRule ^/favicon\.ico$ http://www.debian.org/favicon.ico [L,R]
> -RewriteRule ^/lib([^/])([^/]+)$ /lib$1/lib$1$2.html [L,R]
> -RewriteRule ^/([^/])([^/]+)$ /$1/$1$2.html [L,R]
> -RewriteCond %{QUERY_STRING} ^src=lib(.)(.+)$
> +RewriteRule ^/\s*lib([^/])([^/]+)\s*$ /lib$1/lib$1$2.html [L,R]
> +RewriteRule ^/\s*([^/])([^/]+)\s*$ /$1/$1$2.html [L,R]
> +RewriteCond %{QUERY_STRING} ^src=\s*lib(.)(.+)\s*$
> RewriteRule ^/common/index.html$ /lib%1/lib%1%2.html? [L,R,NE]
> -RewriteCond %{QUERY_STRING} ^src=(.)(.+)$
> +RewriteCond %{QUERY_STRING} ^src=\s*(.)(.+)\s*$
> RewriteRule ^/common/index.html$ /%1/%1%2.html? [L,R,NE]
> </VirtualHost>
This patch does not strip trailing whitespaces. The [^/]+ or .+ are greedy
and will eat the whitespaces. Thus \s*$ will always match the empty
string.
Please update your patch.
Cheers,
--
Raphaël Hertzog ◈ Debian Developer
Follow my Debian News ▶ http://RaphaelHertzog.com (English)
▶ http://RaphaelHertzog.fr (Français)
Reply to: