CC: | gburger [...] cs.up.ac.za,kevin [...] weblab.com,oliver [...] linux-kernel.at |
Subject: | Make the client IP and/or connection information available to server |
Per request from multiple sources:
The server should have access to the basic connection information of the
client that has sent the request currently in the dispatch pipeline. See
the attached patch from Oliver Falk. This information should somehow be
associated with the request, not the server object, for multi-threaded
server scenarios. Also, try to see how to make it work for Apache and
Net::Server cases.
Subject: | Client Address with RPC::XML::Server.eml |
X-Mozilla-Status: 0003
X-Mozilla-Status2: 00000000
Return-Path: <oliver@linux-kernel.at>
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on shell.rawbw.com
X-Spam-Level:
X-Spam-Status: No, score=0.1 required=7.0 tests=BAYES_00,FORGED_RCVD_HELO
autolearn=ham version=3.1.0
Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41])
by shell.rawbw.com (8.11.6p2/8.11.6) with ESMTP id k1EFAT888465
for <rjray@shell.rawbw.com>; Tue, 14 Feb 2006 07:10:29 -0800 (PST)
Received: from mail.linux-kernel.at (pils.linux-kernel.at [213.129.242.82])
by mail0.rawbw.com (8.11.6p2/8.11.6) with ESMTP id k1EFASX68980
for <rjray@blackperl.com>; Tue, 14 Feb 2006 07:10:28 -0800 (PST)
Received: from [127.0.0.1] (localhost [127.0.0.1])
(authenticated bits=0)
by mail.linux-kernel.at (8.13.5/8.13.5) with ESMTP id k1EFAKWu026527
for <rjray@blackperl.com>; Tue, 14 Feb 2006 16:10:21 +0100
Message-ID: <43F1F2E6.1080503@linux-kernel.at>
Date: Tue, 14 Feb 2006 16:10:30 +0100
From: Oliver Falk <oliver@linux-kernel.at>
User-Agent: Thunderbird 1.5 (X11/20060128)
MIME-Version: 1.0
To: rjray@blackperl.com
Subject: Client Address with RPC::XML::Server
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV 0.88/1289/Tue Feb 14 15:36:44 2006 on pils.linux-kernel.at
X-Virus-Status: Clean
X-lkernAT-MailScanner-Information: Please contact the ISP for more information
X-lkernAT-MailScanner: Found to be clean
X-lkernAT-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44,
required 5, autolearn=not spam, ALL_TRUSTED -1.44)
X-MailScanner-From: oliver@linux-kernel.at
Hi Randy!
To be able to retrieve the ip and port of a client within a rpc method,
I would suggest the following:
--- ./lib/RPC/XML/Server.pm.orig 2006-02-14 16:08:38.000000000 +0100
+++ ./lib/RPC/XML/Server.pm 2006-02-14 16:08:46.000000000 +0100
@@ -1223,7 +1223,8 @@
$timeout = $self->{__daemon}->timeout(1);
while (! $exit_now)
{
- $conn = $self->{__daemon}->accept;
+ ($conn, $peer_addr) = $self->{__daemon}->accept;
+ $self->{peer_addr} = $peer_addr if $peer_addr;
last if $exit_now;
next unless $conn;
Please investigate and think about patching it in... It's really a big
problem, that you cannot get the IP from the connecting client...
Best,
Oliver