| Category: | Perl Module patch |
| Author/Contact Info | Vipin Gupta vipgup@yahoo.com vipin@barc.ernet.in |
| Description: | 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;
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Patch for HTTP::Daemon::SSL
by Anonymous Monk on Dec 22, 2005 at 12:28 UTC |