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

Patch for HTTP::Daemon::SSL

Expand Messages
  • vipin gupta
    Hi, Using SOAP::Lite-0.65, I have writted client & server using SOAP::Lite & SOAP::Transport::HTTP::Daemon for my application. The things worked fine with
    Message 1 of 1 , Dec 22, 2005
    • 0 Attachment
      Hi,
      Using SOAP::Lite-0.65, I have writted client & server using SOAP::Lite & SOAP::Transport::HTTP::Daemon for my  application. The things worked fine with plain text communication. For SSL, I installed HTTP::Daemon::SSL for SSL support for HTTP Daemon. But with SSL, The client was getting timed out after SSL handshake is complete.
        After spending hours in trying to sort out SSL timeout problem, I came to know that the problem lies in HTTP::Daemon::SSL. There is a call to "sysread" for reading the client request after SSL handshake. This call tries to read 2048 bytes of data from client. If the client is sending less than 2k data, server waits there & don't come out of sysread call. While client is waiting for response from server, server  gets stuck in sysread call, which ultimately results in SSL timeout.
       
      I have written a patch to solve this problem with HTTP::Daemon::SSL.
       
      cd /usr/lib/perl5/site_perl/5.6.0/HTTP/Daemon
      diff SSL.pm.orig SSL.pm
       
      172,173c172,195
      <       my $n = sysread($self, $_[0], 2048, length($_[0]));
      <        print STDERR sprintf("sysread() just \$n=%s\n",(defined $n?$n:'undef')) if $DEBUG;
      ---
      >#################################################################
      >##################### Patch starts here #########################
      >       my ($x,$n);
      >       my $lent=1;
      >       while($lent<=2048)
      >       {
      >               eval {
      >                       local $SIG{ALRM} = sub{die "alarm\n"};
      >                       alarm(1);
      >                       $n = sysread($self,$x,1);
      >                       alarm(0);
      >                       $_[0] = "$_[0]"."$x";
      >                       $lent++;
      >               };
      >               if($@)
      >               {
      >
      >                       last;
      >               }
      >       }
      >       $n=$lent;
      >##################### Patch ends here #########################
      >#################################################################
      >       print STDERR sprintf("sysread() just \$n=%s\n",(defined $n?$n:'undef')) if $DEBUG;
       
       
      After adding this patch, My SSL Daemon & SSL soap client are communicating properly.
      I hope this will help & save your time.
       
      Cheers
      Vipin


      Vipin Gupta 
      Scientific Officer-C
      2-277 S Mod Labs- D Block,
      Computer Division, B.A.R.C.

      Mumbai-400094
      vipin@... 
      Ph.  9821017677(M), 022-25595411(0)
      (MOD LAB EXTEN. 25411)

      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

    Your message has been successfully submitted and would be delivered to recipients shortly.