Apache -> Nginx miration problem. Different tcp options?
atlantos
nginx-forum at nginx.us
Sun Jun 28 11:37:36 MSD 2009
Further investigation shown that nginx and apache differently handle half-open connections. Bellow is simple in perl to reproduce problem. Problem is caused by shutdown call on client
use IO::Socket::INET;
my $host = "www.server";
my $sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => 'http(80)',
Proto => 'tcp'
);
unless ($sock) { die "cannot connect\n" }
$sock->autoflush(0);
print $sock "HEAD / HTTP/1.1\r\n";
print $sock "Host: ".$host."\r\n";
print $sock "Accept: */*\r\n";
print $sock "Accept-Encoding: identity\r\n";
print $sock "Connection: close\r\n\r\n";
$sock->autoflush(1);
# shutdown call creates problems
# if commented works for nginx and apache
# if uncomented works only with apache
shutdown($sock, 1);
while (my $line = <$sock>) {
$line =~ s/[\r\n]$//;
print $line."\n"; }
close $sock;
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,3492,3494#msg-3494
More information about the nginx
mailing list