Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个响应 HTTP 请求的服务器,它不需要支持保持活动连接(这是在规范中要求的),我想知道用保持活动标头拒绝客户端请求的正确方法是什么。
干杯。
我的 http1.1 有点生疏了,但是在我的脑海中,Connection: Close在响应中发回标头应该可以解决问题。不是拒绝请求......只是向客户端说明我们将关闭连接,尽管有保持活动标题。
Connection: Close
或者,您可以只强制一个没有保持活动概念的 http1.0 响应。