gpt4 book ai didi

http - 默认情况下,HTTP/1.1 请求是否隐式保持事件状态?

转载 作者:可可西里 更新时间:2023-11-01 15:07:11 25 4
gpt4 key购买 nike

已解决:将字节粘贴到此处让我意识到我缺少 block 之间的空行...


HTTP/1.1 请求是否需要指定 Connection: keep-alive header ,还是默认始终保持事件状态?

This guide让我认为它会;也就是说,当我的 http 服务器收到 1.1 请求时,它会保持事件状态,除非明确接收到 Connection: close header 。

我问,因为 abhttperf 的不同客户端行为让我发疯,怀疑我在这个问题上的理智......


这是 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 没有退出。

我的错误在哪里?

最佳答案

来自 RFC 2616, section 8.1.2 :

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com