SimpleXMLRPCServer and client IP address
Jeremy Monnet
jmonnet at gmail.com
Wed Jun 28 11:57:39 EDT 2006
Thanks for your answer !
On 6/28/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> maybe the explanation in that message was good enough for the poster ?
I think so ... unfortunately not for me ... yet ! :-)
>
> Your handler object should be getting set up with the client_address property.
> If not you need to show us some small subset of your app that demonstrates the
> issue.
>
> You can also inherit from SimpleXMLRPCServer and override verify_request, from
> BaseServer, if you want the option of blocking requests based on source
> address.
>
> the second alternative should be straightforward enough:
>
> class MyXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
> def verify_request(self, request, client_address):
> return CheckPerms(client_address)
>
> server = MyXMLRPCServer(...)
> ...
>
> if you need more control, you need to subclass SimpleXMLRPCHandler instead.
this seems easy, but I'm not sure I could use it : I already provide
more than one method (of course not in the snippet of code I provided,
my mistake probably not to show it) and I plan to add several more in
the near future. Overloading verify_request() in this way means I
can't use the same xmlrpcserver for other methods ? Or am I just wrong
? (I should probably have a look at "request", maybe that's a key ?)
Or is it the "more control" you talked about ?
Jeremy
--
Linux Registered User #317862
Linux From Scratch Registered User #16571
Please do not send me .doc, .xls, .ppt, as I will *NOT* read them.
Please send me only open formats, as OpenDocument or pdf.
More information about the Python-list
mailing list