gpt4 book ai didi

http - 处理 http header 中的空格

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

是否应该在 HTTP 请求/响应中忽略前导或尾随空格?

例如,如果一个 HTTP/1.1 兼容的客户端解释这个:

Connection  :   close      \r\n

像这样:

Connection: close\r\n

最佳答案

根据 RFC2616 的第 4.2 段(HTTP/1.1),字段值前面可能有空格,但不是字段名:

Each header field consistsof a name followed by a colon (":") and the field value. Field namesare case-insensitive. The field value may be preceded by any amountof LWS (linear white space), though a single SP is preferred. Header fields can be extended over multiple lines by preceding each extra line with at least one SP or HT. Applications ought to follow "common form", whereone is known or indicated, when generating HTTP constructs, sincethere might exist some implementations that fail to accept anything.

关于http - 处理 http header 中的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31773667/

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