Skip Menu |

This queue is for tickets about the Catalyst-Plugin-SmartURI CPAN distribution.

Report information
The Basics
Id: 43836
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Catalyst-Plugin-SmartURI

People
Owner: rkitover [...] cpan.org
Requestors: ifomichev [...] cpan.org
Cc:
AdminCc:

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



Subject: Catalyst::Plugin::SmartURI compatibility
I'm not sure if it is a bug of Catalyst::Plugin::Server::XMLRPC or Catalyst::Plugin::SmartURI, but these two just don't work together. XMLRPC croaks with "Invalid XMLRPC request: No such method" on any XMLRPC-enabled method even if 'absolute' disposition for Catalyst::Plugin::SmartURI is selected.
Subject: Re: [rt.cpan.org #43836] Catalyst::Plugin::SmartURI compatibility
Date: Wed, 4 Mar 2009 15:38:48 +0100
To: bug-Catalyst-Plugin-Server [...] rt.cpan.org
From: "Jos I. Boumans" <jos [...] dwim.org>
On Mar 4, 2009, at 3:29 PM, Ivan Fomichev via RT wrote: Show quoted text
> Wed Mar 04 09:29:28 2009: Request 43836 was acted upon. > Transaction: Ticket created by IFOMICHEV > Queue: Catalyst-Plugin-Server > Subject: Catalyst::Plugin::SmartURI compatibility > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: ifomichev@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=43836 > > > > I'm not sure if it is a bug of Catalyst::Plugin::Server::XMLRPC or > Catalyst::Plugin::SmartURI, but these two just don't work together. > XMLRPC croaks with "Invalid XMLRPC request: No such method" on any > XMLRPC-enabled method even if 'absolute' disposition for > Catalyst::Plugin::SmartURI is selected.
Hi, could you add a sample TestApp or controller that shows this bug? Thanks, -- Jos Boumans How do I prove I am not crazy to people who are?
Here you are. Invoke with rpc_client -m 'hello' If you comment out SmartURI in lib/TestApp.pm with a hyphen, everything works okay.
Download TestApp.tar.gz
application/x-gzip 39.8k

Message body not shown because it is not plain text.

Hi, On Wed Mar 04 06:29:28 2009, IFOMICHEV wrote: Show quoted text
> I'm not sure if it is a bug of Catalyst::Plugin::Server::XMLRPC or > Catalyst::Plugin::SmartURI, but these two just don't work together. > XMLRPC croaks with "Invalid XMLRPC request: No such method" on any > XMLRPC-enabled method even if 'absolute' disposition for > Catalyst::Plugin::SmartURI is selected.
this one was a real tricky one to track down. It's actually a bug in C:P:SmartURI; the problem is that everytime ->uri is called, it reinstantantiates the uri from $req->base. This means any changes you make to it are lost the next time you access ->uri. And the way the XMLRPC server works is that it changes ->path from the entrypoint (say /rpc) to point to the method (say, /hello). When C:P:SmartURI is loaded, this change is lost, and therefor the XMLRPC methods don't work, as it will try to find a method /rpc. The below patch fixes this for ->uri, by using a URI cache. Other methods in C:P:SmartURI would probably benefit from the same solution, but I'll leave that up to the author. You can apply this patch now to get around the problem you're experiencing as a work around. I'm also moving this ticket to the C:P:SmartURI queue so the author can pick it up. Cheers, --- /opt/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/SmartURI.pm 2009-03-04 18:47:02.000000000 +0100 +++ SmartURI.pm 2009-03-04 18:47:15.000000000 +0100 @@ -167,9 +167,12 @@ $c->prepare_uri($c->next::method(@_)) } -{ +{ package Catalyst::Request::SmartURI; - use base 'Catalyst::Request'; + use base 'Catalyst::Request'; + use parent 'Class::Accessor::Fast'; + __PACKAGE__->mk_accessors('__uri_cache'); + sub uri_with { my $req = shift; @@ -180,13 +183,20 @@ sub uri { my $req = shift; + $req->__uri_cache( {} ) unless $req->__uri_cache; + my $uri_class = $context ? $context->uri_class : $conf_uri_class; - $uri_class->new( - $req->next::method(@_), - ($req->{base} ? { reference => $req->base } : ()) - ) + my $rv = $req->next::method(@_); + + return $req->__uri_cache->{$req.$rv} ||= + $uri_class->new( + $rv, + ($req->{base} ? { reference => $req->base } : ()) + ); } + + sub referer { my $req = shift;
Thank you very much, Jos!
Subject: Catalyst::Plugin::SmartURI compatibility with C::P::Server::XMLRPC
Fixed in 0.031 -- Rafael