Archived Forum Post

Index of archived forum posts


How to make correct GET/POST with Host resolving proxy?

May 09 '13 at 20:24


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

            Uri uri = new Uri("");
            string googleHost= "";
            string googleHostForResolvingSocksProxy= "";

            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.



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..


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 (+
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:

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