HTML filtering

josh hoblitt jhoblitt at
Thu Jul 18 19:26:39 CDT 2002

A blocking call to flock before calling accept on a HTTP::Daemon object
and then releasing doesn't seem to solve the problem.  But calling sleep
1 after an accept seems to make the problem go away as long as your
making serialized connections.

This is a snipet from HTTP::Daemon.  I suspect I need to add some
locking in there but I'm not sure exactly what SUPER is.  Any ideas on
what needs to be done?

sub accept
    my $self = shift;
    my $pkg = shift || "HTTP::Daemon::ClientConn";
    my ($sock, $peer) = $self->SUPER::accept($pkg);
    if ($sock) {
	${*$sock}{'httpd_daemon'} = $self;
	return wantarray ? ($sock, $peer) : $sock;
    } else {


-Joshua Hoblitt

jhoblitt at

----- Original Message -----
From: merlyn at (Randal L. Schwartz)
Date: Thursday, July 18, 2002 1:23 pm
Subject: Re: HTML filtering

> >>>>> "josh" == josh hoblitt <jhoblitt at> writes:
> josh> I discovered something interesting: HTTP:Daemon doesn't work 
> correctlyjosh> on perl 5.6.1/solaris 8.  The object will allow one 
> connection then die
> josh> on the next attempt to call accept.  I tried setting some
> josh> IO::Socket::Inet options with no luck.  The problem is fairly 
> lowleveljosh> as the OS is still holding the socket open for 
> sometime after the code
> josh> exits.  (I verified that the code still works on perl 
> 5.6.1/linux 2.4)
> One of my programs (the preforking server) broke under some OS
> releases because flock() on the master socket isn't supported
> properly.  I had to switch to including __END__ in the program and
> then flocking DATA in the same way (a cheap trick, but effective :).
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 
> 777 0095
> <merlyn at> <URL:" 
> target="l">>Perl/Unix/security 
> consulting, Technical writing, Comedy, etc. etc.
> See for onsite and open-enrollment Perl 
> training!TIMTOWTDI


More information about the Pdx-pm-list mailing list