Decode query components. Without this, one

couldn't specify full PR ID, e.g., bin/12345, in the
"PR number" field of the web form because the slash
was encoded as %2F by many browsers.  Of course,
decoding the query is a must for a cgi in general.
This commit is contained in:
Yaroslav Tykhiy 2006-10-26 11:13:34 +00:00
parent 7579704f65
commit d01457cf1d
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=28934

View file

@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.55 2006/09/23 14:02:27 simon Exp $
# $FreeBSD: www/en/cgi/query-pr.cgi,v 1.56 2006/10/11 21:02:58 danger Exp $
#
use strict;
@ -224,7 +224,8 @@ $main::t_style = "<link href=\"${stylesheet}\" rel=\"stylesheet\" type=\"text/cs
if ($ENV{'QUERY_STRING'}) {
foreach (split(/&/, $ENV{'QUERY_STRING'})) {
my ($key, $val) = split /=/;
my ($key, $val) = map { s/%([0-9a-f]{2})/chr hex $1/egi; $_ }
split /=/;
$f = $val if ($key eq "f");
$PR = $val if ($key eq "pr" or $key eq "q");
$PR = $key if ($key =~ /^(?:$valid_category\/)?$valid_pr$/);