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

Re: [soaplite] accessing client II address for logfile

Expand Messages
  • Artur Brodowski
    ... Try this: use SOAP::Transport::HTTP; sub SOAP::Transport::HTTP::Daemon::handle { my $self = shift- new; while (my ($c, $peer_addr) = $self- accept) { my
    Message 1 of 2 , Jun 13, 2005
    • 0 Attachment
      Dnia 04-06-2005, sob o godzinie 03:03 +0000, adavisirl napisaƂ(a):
      > I'd like to have my SOAP server write the
      > IP address of clients to a logfile. I've been
      > trying to use SOAP::Trace to grab the address, but
      > I guess the headers signal is not yet implemented.

      Try this:

      use SOAP::Transport::HTTP;

      sub SOAP::Transport::HTTP::Daemon::handle {
      my $self = shift->new;

      while (my ($c, $peer_addr) = $self->accept) {
      my ($port, $iaddr) = sockaddr_in($peer_addr);
      $client_ip = inet_ntoa($iaddr);
      _log("Connection from " . $client_ip . ":" . $port . "\n");
      while (my $r = $c->get_request) {
      $self->request($r);
      $self->SOAP::Transport::HTTP::Server::handle;
      $c->send_response($self->response)
      }
      UNIVERSAL::isa($c, 'shutdown') ? $c->shutdown(2) : $c->close();
      undef $c;
      }
      }

      my $daemon = SOAP::Transport::HTTP::Daemon->new(
      # .... args

      $daemon->handle;

      AB.
      --
      only so many songs can be sung with two lips two lungs and one tongue
    Your message has been successfully submitted and would be delivered to recipients shortly.