Problem with HEAD solved by setting fastcgi_ignore_client_abort on
But still getting error on POST. Bellow is code. If $num $num < 853 ( POST length < 1025) everything is ok, if $num >= 853 ( POST length >= 1025) getting error.
use IO::Socket::INET;
my $host = "www.server";
my $num = 853;
my $sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => 'http(80)',
Proto => 'tcp'
);
unless ($sock) { die "cannot connect\n" }
my $string = "POST / HTTP/1.1\r\n";
$string .= "Host: ".$host."\r\n";
$string .= "Accept: */*\r\n";
$string .= "Accept-Encoding: identity\r\n";
$string .= "Connection: close\r\n";
$string .= "Content-Type: application/x-www-form-urlencoded\r\n";
$string .= "Content-Length: ".$num."\r\n\r\n";
for (my $i = 0; $i <$num ; $i++) {
$string .= "x";
}
print $sock $string;
# shutdown call creates problems
# if commented works for nginx and apache
# if uncomented works only with apache
shutdown($sock, 1);
while (my $line = <$sock>) {
print $line if $line =~ /^HTTP.*200 OK/;
}
print "Length: ".length($string)."\n";
close $sock;