- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
已解决:将字节粘贴到此处让我意识到我缺少 block 之间的空行...
HTTP/1.1 请求是否需要指定 Connection: keep-alive
header ,还是默认始终保持事件状态?
This guide让我认为它会;也就是说,当我的 http 服务器收到 1.1 请求时,它会保持事件状态,除非明确接收到 Connection: close
header 。
我问,因为 ab
和 httperf
的不同客户端行为让我发疯,怀疑我在这个问题上的理智......
这是 httperf --hog --port 42042 --print-reply body
发送的内容:
GET / HTTP/1.1
User-Agent: httperf/0.9.0
Host: localhost
这是我的服务器的响应:
HTTP/1.1 200 OK
Connection: keep-alive
Transfer-Encoding: chunked
Content-Length: 18
12
Hello World 1
0
httpref
立即打印出响应,但随后只是坐在那里,双方都没有关闭连接并且 httpref
没有退出。
我的错误在哪里?
最佳答案
A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior of any HTTP connection. That is, unless otherwise indicated, the client SHOULD assume that the server will maintain a persistent connection, even after error responses from the server.
关于http - 默认情况下,HTTP/1.1 请求是否隐式保持事件状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7927566/
我是一名优秀的程序员,十分优秀!