0

我正在尝试向localhost:80(nginx-server)发送很多后期请求。

我发送的标题是:

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

伪代码是:

TCPSocket sock('localhost', 80);
for(;;) {
   sock.sendPost();
}
sock.close();

但服务器一次返回:

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

因此,服务器不适用于循环中的所有其他后请求。

为什么不Connection: Keep-Alive工作,服务器返回Connection: close

4

1 回答 1

0

设置keepalive_timeoutkeepalive_requests适当的值

于 2012-04-16T17:41:58.040 回答