You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Impy <im...@65535.com> on 2007/02/09 17:30:31 UTC
Over writing the host header does not work
Hi all
I'm currently trying to over write the host header using 3.1-beta using:
setRequestHeader("Host", "www.google.com")
However httpclient seems to ignore this requests, or it writes over it again
(I'm not sure currently sure what it is doing)
so if i do the following
httpget = new GetMethod("http://66.249.93.147/");
httpget.setRequestHeader("Host", "www.google.com");
etc etc......
It will send a request with the host header set as
Host: 66.249.93.147
and not
Host: www.google.com
Is this something I am doing wrong, or is a bug?
Thank in advance for any help
Impy
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: Over writing the host header does not work
Posted by Impy <im...@65535.com>.
On Friday 09 February 2007 16:49, Roland Weber wrote:
> Hello Impy,
>
> the value of the Host: header is controlled by HttpClient
> and can not be set manually. Use the VIRTUAL_HOST parameter
> to tell HttpClient which value to use:
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/htt
>pclient/params/HttpMethodParams.html#setVirtualHost(java.lang.String)
>
> cheers,
> Roland
>
Thank you for your super fast responce!
httpclient.getParams().setVirtualHost("www.google.com");
did the trick.
Thanks again!
Impy
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: Over writing the host header does not work
Posted by Roland Weber <ht...@dubioso.net>.
Hello Impy,
the value of the Host: header is controlled by HttpClient
and can not be set manually. Use the VIRTUAL_HOST parameter
to tell HttpClient which value to use:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html#setVirtualHost(java.lang.String)
cheers,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org