CC: | Markus Jansen <markus.jansen [...] ericsson.com> |
Subject: | POE::Component::Server::REST 1.03: Extracted key is always empty |
Date: | Wed, 15 Jun 2011 11:15:56 +0200 |
To: | "bug-POE-Component-Server-REST [...] rt.cpan.org" <bug-POE-Component-Server-REST [...] rt.cpan.org> |
From: | Markus Jansen <markus.jansen [...] ericsson.com> |
Hello Jean,
I think I have found a defect in POE::Component::Server::REST 1.03; I simply cannot get a key argument extracted from a URL.
The attached patch works (main change in the "unless" line, the others are just a sort of hardening ...).
It would be great if you could consider the patch with Component::Server::REST 1.04 (or tell me what I am doing wrong).
Best regards,
Markus Jansen
diff -c /vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Server/REST.pm perl5/POE/Component/Server
*** /vobs/cc/CCA-perl01/perl5____________________sixtyfive_char_path/prod/lib/site_perl/5.10.1/POE/Component/Server/REST.pm Sat Jun 11 15:52:40 2011
--- perl5/POE/Component/Server/REST.pm Wed Jun 15 11:11:21 2011
***************
*** 547,553 ****
# Get the method name
my $uri = $request->uri;
debug(" requested uri: $uri");
! unless ( $uri =~ /(\/\D+)(\/\w+)?(\/)?(\?session=(.+))?$/ ) {
$kernel->yield( 'FAULT', $response, CLIENT_BADREQUEST, 'Bad Request', "Unrecognized REST url structure: $uri", );
return;
}
--- 547,553 ----
# Get the method name
my $uri = $request->uri;
debug(" requested uri: $uri");
! unless ( $uri =~ /(\/\D+?)(\/\w+)?(\/)?(\?w+=(.+))?$/ ) {
$kernel->yield( 'FAULT', $response, CLIENT_BADREQUEST, 'Bad Request', "Unrecognized REST url structure: $uri", );
return;
}
***************
*** 557,564 ****
my $restkey = $2 || '';
# Remove trailing slash
! $method =~ s/\/$//;
! $restkey =~ s/^\///;
# Add prefx with given HTTP request method eg. PUT/foo/baz/bar
$method = "$type$method";
--- 557,564 ----
my $restkey = $2 || '';
# Remove trailing slash
! $method =~ s,/+$,,;
! $restkey =~ s,^/+,,;
# Add prefx with given HTTP request method eg. PUT/foo/baz/bar
$method = "$type$method";
Markus Jansen
Ericsson GmbH
Eurolab R&D
Ericsson Allee 1
52134 Herzogenrath, Germany
Phone +49 2407 575 5157
Fax +49 22407 575 150
Mobile +49 172 2742003
markus.jansen@ericsson.com
www.ericsson.com
Ericsson GmbH. Sitz: Düsseldorf. Registergericht: Amtsgericht Düsseldorf, HRB 33012. Geschäftsführer: Stefan Koetz (Vors.), Nils de Baar, Bernd Schmidt. Aufsichtsratsvorsitzender: Anders Runevad.
This Communication is confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>.