【发布时间】:2012-04-17 01:41:58
【问题描述】:
我正在尝试向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?
【问题讨论】:
标签: sockets nginx http-post keep-alive