On Mon, Jun 25, 2012 at 09:30:19AM +0200, Salvatore Bonaccorso wrote:

> [08:06] < intrigeri> no idea why RPC::XML::Client->new + ->simple_request 
> don't return what they should. Probably the server side is not doing it's job 
>                      properly at some level.
> [08:07] < intrigeri> I think the right place to look is 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666651#22, but looking there 
> does not help me.

The attached patch seems to work for me, but I'm behind a bad net
connection and my testing wasn't very thorough.

It should work with both Net::Server 2.005 and 0.99, but it would be nice
if somebody could verify that. Also checking with unpatched versions,
particularly 0.99, would probably be good.
-- 
Niko Tyni   nt...@debian.org
>From cf85d9f0a44e1a79ecab91b8951d5bb546576a81 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Mon, 25 Jun 2012 19:20:41 +0300
Subject: [PATCH] Net::Server 2.x compatibility

Newer versions of Net::Server bless the client connection to a subclass
like Net::Server::Proto::TCP, breaking the check for an already blessed
HTTP::Daemon::ClientConn and making all connections fail with errors like

 Can't locate object method "get_request" via package "Net::Server::Proto::TCP" at /home/niko/tmp/librpc-xml-perl-0.76/blib/lib/RPC/XML/Server.pm line 828.

Explicitly test for the get_request method that we need
from HTTP::Daemon::ClientConn.
---
 lib/RPC/XML/Server.pm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/RPC/XML/Server.pm b/lib/RPC/XML/Server.pm
index 97a8c03..55c59c5 100644
--- a/lib/RPC/XML/Server.pm
+++ b/lib/RPC/XML/Server.pm
@@ -798,7 +798,7 @@ sub process_request ## no critic (ProhibitExcessComplexity)
     );
 
     my $me = ref($self) . '::process_request';
-    if (! ($conn && ref $conn))
+    if (! ($conn && ref $conn && $conn->can('get_request')))
     {
         $conn = $self->{server}->{client};
         bless $conn, 'HTTP::Daemon::ClientConn';
-- 
1.7.10

Reply via email to