Skip Menu |

This queue is for tickets about the AnyEvent-HTTPD CPAN distribution.

Report information
The Basics
Id: 64403
Status: resolved
Priority: 0/
Queue: AnyEvent-HTTPD

People
Owner: Nobody in particular
Requestors: nrh [...] HEP.CAT
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: support ';' as pair separator
Date: Sun, 2 Jan 2011 18:26:30 -0500
To: bug-AnyEvent-HTTPD [...] rt.cpan.org
From: nicholas harteau <nrh [...] HEP.CAT>
here's a patch against 79ca598 to support ';' as a pair separator, I believe this is the W3C recommendation: http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 I also fixed the manifest, as it seems to be out of date. https://gist.github.com/762903 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"); -- nrh@HEP.CAT (>^-^)>
Patch applied, going to be online in version 0.90.