通过 NTLM 身份验证代理服务器进行 HTTP 连接
我正在尝试通过 NTLM 身份验证代理服务器编写 Connect 调用。我打开一个到代理服务器的套接字并向其发送“CONNECT xxx49:80 HTTP/1.1\r\n\r\n”。我预计这会失败,因为它是一个身份验证代理服务器,但它失败了,并且还关闭了我与代理服务器的连接。我正在使用 Wireshark 检查数据包值。我可以看到“代理连接:关闭\r\n”。如果我执行 GET 它不会关闭连接。 我的问题是,失败的 Connect 调用关闭我的套接字连接是否正确?
I am trying to write Connect calls via a NTLM authenticating proxy server. I open a socket to the proxy server and send it a “CONNECT x.x.x.49:80 HTTP/1.1\r\n\r\n”. I expect this to fail as it is an authenticating proxy server but it fails and also closes my connection to the proxy server. I am using Wireshark to check packet values. I can see “Proxy-Connection: close\r\n”. If I do a GET it does not close the connection.
My question is if it is correct for a failed Connect call to close my socket connection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 100% 清楚你的问题 - 我不希望 NTLM 代理服务器的第一个 CONNECT 失败,因为它应该发送回 Proxy-Authenticate: NTLM 标头。
无论如何,代理服务器完全有权在发生故障时关闭客户端连接,因此您的问题的答案是“是”。奇怪的是,它对 GET 没有做同样的事情,但是代理作为对 CONNECT 的响应所能做的事情受到更多限制,并且这个代理可能会决定它不能支持您的请求的 HTTPS。
I'm not 100% clear about your question - I would not expect the first CONNECT to fail with an NTLM proxy server, as it should have sent a Proxy-Authenticate: NTLM header back.
In any case, proxy server has the full right to close the client-side connection in a case of failure, so the answer to your question is "yes". It is odd that it does not do the same for GET, however proxies are more limited with what they can do as a response to CONNECT, and this one may decide that it can't support HTTPS for your request.