gpt4 book ai didi

http - WebLogic 为空的主机 header 请求返回 Bad Request

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

我正在尝试调用托管在 WebLogic 服务器中的 WebService。每次我在“主机” header 中使用空值调用它时,我都会收到“400 - 错误请求”响应。如果我在主机 header 中放入一些东西,请求就可以了,我可以使用 WS。RFC 说:

A client MUST include a Host header field in all HTTP/1.1 request messages . If the requested URI does not include an Internet host name for the service being requested, then the Host header field MUST be given with an empty value

当我发送带有空值的主机时,我发送的是没有主机名的 URI,因此,根据 RFC,我做得很好。

这是我收到错误请求的 HTTP header :

POST /myContent/myWebService HTTP/1.1
SOAPAction: mySOAPcall
Connection: Keep-Alive
Host:
Content-Type: text/xml;charset=UTF-8
Content-Length: 709

如果我放置主机,它工作正常:

POST http://mydomain.com.br/myContent/myWebService HTTP/1.1
SOAPAction: mySOAPcall
Connection: Keep-Alive
Host: mydomain.com.br
Content-Type: text/xml;charset=UTF-8
Content-Length: 709

我是否在带有空主机 header 的请求中遗漏了某些内容?

最佳答案

查看 RFC 规范,我找不到以下引用:

A client MUST include a Host header field in all HTTP/1.1 request messages . If the requested URI does not include an Internet host name for the service being requested, then the Host header field MUST be given with an empty value

但是在第 3.2 节中我发现:

Invalid whitespace around field-names is now required to be rejected,because accepting it represents a security vulnerability. The ABNFproductions defining header fields now only list the field value.(Section 3.2)

https://www.rfc-editor.org/rfc/rfc7230#section-3.2

是否有可能将空值解释为无效空格?

关于http - WebLogic 为空的主机 header 请求返回 Bad Request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56811344/

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