huzhangyou 来,继续讨论 IE 和 TIdHTTP 的实现
接上文:http://community.csdn.net/Expert/TopicView.asp?id=5578851
用TIdHTTP直接Get("http://www.csdn.net")
抓包结果是:
10.123.106.35 211.100.26.123 TCP 1746>80 [SYN] Seq=0 Len=0 MSS=1460
10.123.106.35 211.100.26.123 TCP 1746>80 [SYN] Seq=0 Len=0 MSS=1460
10.123.106.35 211.100.26.123 TCP 1746>80 [SYN] Seq=0 Len=0 MSS=1460
三次相同, 显然它是试图去连csdn(211.100.26.123), 连接三次没搞定,显示超时.
设置了ProxyParams后:
10.123.106.35 10.123.20.9 HTTP GET http://www.csdn.net:80/ HTTP/1.1 //下面的Proxy-Authorization: Basic Og==\r\n)
10.123.20.9 10.123.106.35 TCP [TCP segment of a reassembled PDU]
10.123.20.9 10.123.106.35 TCP [TCP segment of a reassembled PDU]
10.123.20.9 10.123.106.35 TCP [TCP segment of a reassembled PDU] //这些TCP传送的应该就是下面HTTP的一部分,最后型成一个HTTP协议
10.123.20.9 10.123.106.35 HTTP HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the web Proxy service is denied. )\r\n
10.123.106.35 10.123.20.9 TCP 1775>8080 [ACK] Seq=169 Ack=4565 win=17520
添加了User和Password后:
10.123.106.35 10.123.20.9 HTTP GET http://www.csdn.net:80/ HTTP/1.1 //下面的Proxy-Authorization: Basic 有内容了^_^
10.123.20.9 10.123.106.35 HTTP Continuation or non-HTTP traffic //没有权限
对比IE的数据包,它的GET请求里的Proxy-Authorization是: NTLM .... 而不是 Basic.
我在Indy源码里找到一个叫TIdNTLMAuthentication的,它貌似可以生成NTLM的Authentication.但是只要一执行new TIdNTLMAuthentication就退出了,不知道这是怎么用的