Welcome! Log In Create A New Profile

Advanced

Re: Apache -> Nginx miration problem. Different tcp options?

June 28, 2009 03:37AM
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;
Subject Author Posted

Apache -> Nginx miration problem. Different tcp options?

atlantos June 28, 2009 12:19AM

Re: Apache -> Nginx miration problem. Different tcp options?

atlantos June 28, 2009 03:37AM

Re: Apache -> Nginx miration problem. Different tcp options?

atlantos June 28, 2009 05:42AM

Re: Apache -> Nginx miration problem. Different tcp options?

Maxim Dounin June 29, 2009 07:51AM

Re: Apache -> Nginx miration problem. Different tcp options?

Nelson Serafica June 28, 2009 08:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 150
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready