Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Patch for HTTP::Daemon::SSL

3 views
Skip to first unread message

vi...@barc.ernet.in

unread,
Dec 22, 2005, 1:54:56 AM12/22/05
to mod...@cpan.org

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

Computer Division

BARC, Trombay Mumbai

phone: 25593671 (o)

Mobile: 9821017677

 


--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/143 - Release Date: 10/19/2005

Adam Kennedy

unread,
Dec 22, 2005, 11:39:36 AM12/22/05
to mod...@perl.org, vi...@barc.ernet.in, mod...@cpan.org
Vipin

Bug reports and patches should be submitted via the bug tracking system at

http://rt.cpan.org/

Locate the module there and submit your patch there.

This mailing list tends to deal with more general issues like author
registration, module naming, and various structural problems.

Adam K

0 new messages