From 02efe3215eb067422bffdd84158a73d46cb8c521 Mon Sep 17 00:00:00 2001
From: Nigel Kukard <nkukard@lbsd.net>
Date: Tue, 14 Jan 2014 07:54:56 +0000
Subject: [PATCH] Decode values used in URI's

---
 opentrafficshaper/utils.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/opentrafficshaper/utils.pm b/opentrafficshaper/utils.pm
index 3fac800..0b3bafc 100644
--- a/opentrafficshaper/utils.pm
+++ b/opentrafficshaper/utils.pm
@@ -122,10 +122,12 @@ sub parseURIQuery
 	# Loop with the components in sets of name & value
 	while (@components) {
 		my ($name,$value) = (shift(@components),shift(@components));
-
-		# Store values and the last value we go
-		push(@{$res{$name}->{'values'}},$value);
+		# Unescape name value pair
+		$name =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
+		$value =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
+		# Add to hash
 		$res{$name}->{'value'} = $value;
+		push(@{$res{$name}->{'values'}},$value);
 	}
 
 	return \%res;
-- 
GitLab