Loading ...
Sorry, an error occurred while loading the content.

Gzip in XMLRPC::Lite & logging client peer address

Expand Messages
  • dennis.davidoff
    Hello, all! I have two questions about XMLRPC::Lite. -- 1. Can I use gzip for XMLRPC::Transport::HTTP::Daemon? Server: #!/usr/bin/perl -I
    Message 1 of 1 , Feb 5, 2009
    • 0 Attachment
      Hello, all!

      I have two questions about XMLRPC::Lite.

      -- 1. Can I use gzip for XMLRPC::Transport::HTTP::Daemon?

      Server:

      #!/usr/bin/perl -I /usr/home/null/.Eclipse/RT/lib
      # vim: ts=8:sw=4

      use strict;
      use warnings;
      use XMLRPC::Lite +trace => 'all';
      use XMLRPC::Transport::HTTP;
      use Router;
      use Data::Dumper;

      my $daemon = XMLRPC::Transport::HTTP::Daemon
      -> new (LocalPort => 9850, ReuseAddr => 1)
      -> options({compress_threshold => 1000})
      -> dispatch_to('Router');

      $daemon->handle;

      (there's one method in Router package which returns alot of data, I
      want to compress it)

      Client:

      #!/usr/bin/perl -w
      use strict;
      use XMLRPC::Lite +trace => 'all';
      use Data::Dumper;

      my $client = XMLRPC::Lite
      ->proxy('http://localhost:9850/', options => {compress_threshold
      => 1})
      ->on_fault(sub { die "Transport error: " . $_[1]->faultstring });

      print Dumper($client->call('Router.GetAddrList', '192.168.0')->result);

      While digging client's trace I saw that the first client's query were
      packed, that the header:

      POST http://localhost:9850/ HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Accept-Encoding: gzip
      Content-Encoding: gzip
      Content-Length: 147
      Content-Type: text/xml

      Server answer for that request:
      415 Unsupported Media Type

      For next time the client tried to make not compressed re-request and
      got non compressed answer. Notice that Accept-Encoding is exists in
      client. Server answered with 37 Kb content. Why server not compress
      answer data?

      -- 2. How to log host peers that connects to a server?

      For example, client request Router.GetAddrList, is there a method to
      log client's host peer (IP address) in my package Router? As I guess I
      somehow I may get an access to {client_socket}->peerhost and
      {client_socket}->peerport. Could you show an example?

      Thanks!

      --
      Sincerely,
      Dennis S.Davidoff
    Your message has been successfully submitted and would be delivered to recipients shortly.