I’m trying to send a lot of post-requests to the localhost:80 (nginx-server).
The headers I’m sending are:
POST /LINK HTTP/1.1
User-Agent: User agent
Host: localhost
Accept: */*
Connection: Keep-Alive
Content-Type: application/octet-stream
Content-Length: 16
DATA 16 BYTES
The pseudocode is:
TCPSocket sock('localhost', 80);
for(;;) {
sock.sendPost();
}
sock.close();
But server returns first time:
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 16 Apr 2012 14:54:26 GMT
Content-Type: application/json
Content-Length: 92
Connection: close
ANSWER 92 BYTES
So server doesn’t work with all another post-request from cycle.
Why does not Connection: Keep-Alive work and server returns Connection: close?
Set
keepalive_timeoutandkeepalive_requeststo proper values.