3

このコード

        using (WebClient webClient = new WebClient())
        {
            string address = "https://www.any.com/name.htm";
            byte[] postData = Encoding.ASCII.GetBytes("login=123");
            webClient.Headers[HttpRequestHeader.Accept] = "text/html, application/xhtml+xml, */*";
            webClient.Headers[HttpRequestHeader.AcceptLanguage] = "ru-RU";
            webClient.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
            webClient.Headers[HttpRequestHeader.AcceptEncoding] = "gzip, deflate";
            webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            webClient.UploadData(address, postData);
        }

このリクエストを生成します(postDataは2倍になります):

POST /name.htm HTTP/1.1
Accept-Language: ru-RU
Accept-Encoding: gzip, deflate
Accept: text/html, application/xhtml+xml, */*
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Host: [url]www.any.com[/url]
Content-Length: 9
Connection: Keep-Alive

login=123login=123

変えたら

string address = "https://www.any.com/name.htm"

string address = "http://www.any.com/name.htm"

そうすれば、データは2倍になりません。

HTTPSでリクエストを送信するときに、データの重複を回避するにはどうすればよいですか?

4

1 に答える 1

0

HttpAnalizer のバグです。

Hardradaに感謝します。

于 2012-11-11T11:03:31.877 に答える