http post 在 windows 服务器 2012 上没有响应

http post not responding on windows server 2012

我正在开发一个使用 http post 来做一些事情的软件。 http post 在任何地方都能完美运行,但在 windows server 2012 中它需要特定的 header 顺序。我附上提琴手截图。在屏幕截图中,您可以看到,如果我更改 header 命令,它就会停止工作。

具体订单有效:

将主机更改为其他线路无效:

Header 顺序对于不同名称的 header 并不重要(具有相同名称的 header 的顺序很重要):

RFC 2616 Section 4.2 Message Headers

The order in which header fields with differing field names are received is not significant. However, it is "good practice" to send general-header fields first, followed by request-header or response-header fields, and ending with the entity-header fields.

RFC 7230 Section 3.2.2 Field Order:

The order in which header fields with differing field names are received is not significant. However, it is good practice to send header fields that contain control data first, such as Host on requests and Date on responses, so that implementations can decide when not to handle a message as early as possible. A server MUST NOT apply a request to the target resource until the entire request header section is received, since later header fields might include conditionals, authentication credentials, or deliberately misleading duplicate header fields that would impact request processing.

如果 HTTP 服务器在 Host header 不符合要求的顺序时无法正常工作,那么它违反了 HTTP 规范,因为 header 可以以任何顺序出现,服务器必须准备好处理。