本文介绍了是默认情况下隐式保持活动的HTTP / 1.1请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决了 :粘贴这里的字节让我意识到我在块之间缺少空行......

Solved: pasting the bytes here made me realise that I was missing empty lines between chunks...

HTTP / 1.1请求是否需要指定 Connection:keep-alive 标头,还是始终保持活动状态默认情况下?

Does an HTTP/1.1 request need to specify a Connection: keep-alive header, or is it always keep-alive by default?

让我觉得它会;当我的http服务器收到1.1请求时,除非显式接收 Connection:close header,否则它是keep-alive。

This guide made me think it would; that, when my http server gets a 1.1 request, it is keep-alive unless explicitly receiving a Connection: close header.

我问,因为我的 ab httperf 的不同客户行为让我疯狂到想知道我的理智在这一个......

I ask since my the different client behaviour of ab and httperf is driving me mad enough to wonder my sanity on this one...

这是什么 httperf --hog --port 42042 - 打印回复正文发送:

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

httpref promptly prints out the response, but then just sits there, neither side closing the connection and httpref not exiting.

哪里是我的错误?

解决方案

来自 :

这篇关于是默认情况下隐式保持活动的HTTP / 1.1请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 09:00