login about faq


My Socks proxy resolves hostnames from "www.google.com.foo.bar" to "www.google.com". What do I have to do that the Google server gets the right host value "www.google.com" and not "www.google.com.foo.bar"?

            Uri uri = new Uri("http://www.google.com/search?q=chilikat");
            string googleHost= "www.google.com";
            string googleHostForResolvingSocksProxy= "www.google.com.foo.bar";

            Chilkat.HttpRequest req = new Chilkat.HttpRequest();
            req.Path = uri.PathAndQuery;
            req.AddHeader("Host", googleHost);

                    req.HttpVerb = WebRequestMethods.Http.Post;

            Chilkat.HttpResponse resp = http.SynchronousRequest(googleHostForResolvingSocksProxy, 80, false, req);

I think GET is working well, but I can not check it yet (correct host and request headers). POST is definitly not working. I get a "Not Found" error. Probably because of wrong Host header.

What do I have to change? Could you help me please.


asked May 07 '13 at 21:55

BlackMatrix's gravatar image


edited May 07 '13 at 21:57

You can see the exact HTTP request sent by setting the http.SessionLogFilename property to the path of a file that the Chilkat.Http object will create/append when sending requests. Once you see what is actually sent, it might provide the clue as to what is wrong..


answered May 08 '13 at 11:53

chilkat's gravatar image

chilkat ♦♦

Ah, nice feature. Redirection was the problem. Chilikat is doing a bad request if you get redirected.

It doint the following redirecting GET request:

GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip
User-Agent: Chilkat/1.0.0 (+http://www.chilkatsoft.com/ChilkatHttpUA.asp)
Host: www.google.com
Connection: Keep-Alive

I think I have to define the order and the values of the Chilikat.Http object, not just for HttpRequest. Maybe then Redirection is working with the same headers as the HttpRequest object.

Question: I'm using Send- and SaveCookies from Chilikat.Http. How could I change the order of the headers? Cookie header must be before Connection: Keep-Alive not at the end like the following:

Host: www.google.com
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 10
Cookie: name=value

answered May 08 '13 at 18:40

BlackMatrix's gravatar image


The order of headers should never matter.

(May 09 '13 at 11:04) chilkat ♦♦

In my case the order have to be like a typical browser request. So I think I have to implement my own logic of correct GET/POST requests after redirection and for cookie handled requests. In case of redirection, I have to read the response and make a new request. In case of cookies I have to read all cookies out of XML and put them at the correct place in the request. Everything right?

(May 09 '13 at 20:24) BlackMatrix
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: May 07 '13 at 21:55

Seen: 1,577 times

Last updated: May 09 '13 at 20:24

powered by OSQA