Created
January 2, 2011 22:55
-
-
Save nrh/762903 to your computer and use it in GitHub Desktop.
patch to AnyEvent::HTTPD @ 79ca598
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/MANIFEST b/MANIFEST | |
index 6b03cd5..918824f 100644 | |
--- a/MANIFEST | |
+++ b/MANIFEST | |
@@ -1,7 +1,7 @@ | |
Changes | |
MANIFEST | |
Makefile.PL | |
-README | |
+TODO | |
t/00-load.t | |
t/pod.t | |
lib/AnyEvent/HTTPD/HTTPServer.pm | |
@@ -16,7 +16,10 @@ samples/delayed_example | |
samples/delayed_2_example | |
samples/large_response_example | |
t/00-load.t | |
+t/01_basic_request.t | |
t/02_simple_requests.t | |
t/03_keep_alive.t | |
+t/04_param.t | |
t/05_mp_param.t | |
t/06_long_resp.t | |
+t/07_param_semicolon.t | |
diff --git a/lib/AnyEvent/HTTPD/Util.pm b/lib/AnyEvent/HTTPD/Util.pm | |
index 13403f5..2f4a2e7 100644 | |
--- a/lib/AnyEvent/HTTPD/Util.pm | |
+++ b/lib/AnyEvent/HTTPD/Util.pm | |
@@ -29,7 +29,7 @@ sub url_unescape { | |
sub parse_urlencoded { | |
my ($cont) = @_; | |
- my (@pars) = split /\&/, $cont; | |
+ my (@pars) = split /[\&\;]/, $cont; | |
$cont = {}; | |
for (@pars) { | |
diff --git a/t/07_param_semicolon.t b/t/07_param_semicolon.t | |
new file mode 100644 | |
index 0000000..f7a0849 | |
--- /dev/null | |
+++ b/t/07_param_semicolon.t | |
@@ -0,0 +1,40 @@ | |
+#!perl | |
+use common::sense; | |
+use Test::More tests => 2; | |
+use AnyEvent::Impl::Perl; | |
+use AnyEvent; | |
+use AnyEvent::HTTPD; | |
+ | |
+my $h = AnyEvent::HTTPD->new (port => 19090); | |
+ | |
+my $req_q; | |
+my $req_n; | |
+ | |
+$h->reg_cb ( | |
+ '/test' => sub { | |
+ my ($httpd, $req) = @_; | |
+ $req_q = $req->parm ('q'); | |
+ $req_n = $req->parm ('n'); | |
+ $req->respond ({ content => ['text/plain', "Test response"] }); | |
+ }, | |
+); | |
+ | |
+my $c; | |
+my $t = AnyEvent->timer (after => 0.1, cb => sub { | |
+ my $p = fork; | |
+ if (defined $p) { | |
+ if ($p) { | |
+ $c = AnyEvent->child (pid => $p, cb => sub { $h->stop }); | |
+ } else { | |
+ `wget 'http://localhost:19090/test?q=%3F%3F;n=%3F2%3F' -O- 2>/dev/null`; | |
+ exit; | |
+ } | |
+ } else { | |
+ die "fork error: $!"; | |
+ } | |
+}); | |
+ | |
+$h->run; | |
+ | |
+is ($req_q, "??", "parameter q correct"); | |
+is ($req_n, "?2?", "parameter n correct"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment