edit: I'm also not convinced HttpListener does anything
- So response headers != request headers for the next post.
- Why does a browser begin with correct request headers, but a simple GET HTTP / 1.1 from my client not look the same even tho the originating request headers change per domain a lot of times???????
- This doesn't use the cookies properly either. Why is that?
How do I work something to give me this browser magic?
*WebClient has no .RequestHeaders.
*Comparing HttpWebRequest headers to Chrome/Fiddler sniffing.
using System.Net;
private void Form1_Load(object sender, EventArgs e)
{
CookieContainer cookieJar = new CookieContainer();
cookieJar.GetCookies(new Uri("https://www.google.com"));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.google.com");
request.CookieContainer = cookieJar;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
this.Text = request.Headers.Count.ToString();
WebHeaderCollection header = request.Headers;
for (int i = 0; i < header.Count; i++)
{
richTextBox1.AppendText(header.GetKey(i) + ": " + header[i] + "\n");
}
}
Fiddler/Chrome combo returns 10 Request headers; The client returns 2.
Also why does a header "Accept-Encoding: gzip,deflate,sdch" always make the response some weird 2 character flop of data?