0
我已經創建了TCP代理,用於監聽端口80(端口80未被任何其他服務使用),用於傳入連接。當我使用「Localhost」或「127.0.0.1」作爲IP地址 作爲監聽套接字時,代理能夠接收POST請求。TCP套接字監聽器 - 請求從POST更改爲GET?
Socket listner = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80);
listner.Bind(localEndpoint);
listner.Listen();
然而,當我更換的「localhost」我machine.The代理服務器的IP(191.151.43.22)偵聽連接時收到客戶端的請求是「GET請求」
Socket listner = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndpoint = new IPEndPoint(IPAddress.Parse("191.151.43.22"), 80);
listner.Bind(localEndpoint);
listner.Listen();
客戶端請求使用我機的IP(191.151.43.22),用於連接收聽時使用本地主機/ 127.0.0.1
POST /?toke=abc455/../Control.html?s=783&i=0&t=134 HTTP/1.1
Host: localhost:58888
Connection: keep-alive
Content-Length: 0
Origin: http://localhost:58888
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) C
hrome/21.0.1180.89 Safari/537.1
Content-Type: text/plain;charset=UTF-8
Accept: */*
Referer: http://localhost:58888/?toke=abc455/../Stream.html?s=0&d=%22
localhost%22&p=0&t=1348652703126
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: style=null
客戶端請求
GET /?token=abc344/../Stream.html?s=0&d=%22localhost%22&p=0&t=13486531
37269 HTTP/1.1
Host: 192.168.53.50
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) C
hrome/21.0.1180.89 Safari/537.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
爲什麼POST不能與系統的IP地址一起工作,而是在使用'localhost'代替IP時工作。
請求信息本身並沒有透露太多,除了你將採用不同的路徑Control.html vs Stream.html。這聽起來像是代理配置問題,在這種情況下可能不屬於SO。 –