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 Taneeda <r....@web.de> on 2009/04/21 21:13:09 UTC

HttpClient 4: Disable Default Header

Hi at all,

Currently I am working with the httpclient framework at work. I am
programming an application for automatically testing http products.

To test a proband, i need to disable the default header (host, connection)
in the httpclient framework.

Is it possible to disable the adding of the header Host and Connection to
each request, if they aren't defined in the request?


Yours sincerely, Taneeda
-- 
View this message in context: http://www.nabble.com/HttpClient-4%3A-Disable-Default-Header-tp23162913p23162913.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: HttpClient 4: Disable Default Header

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, Apr 22, 2009 at 01:16:46AM -0700, Taneeda wrote:
> 
> Hi guys,
> 
> I solved this problem now. The solution ist to remove the RequestConnControl
> and the RequestTargetHost Interceptor from clients (DefaultHttpClient)
> HttpProcessor (BasicHttpProcessor).
> 
> /**
>  * RequestInterceptors adds MUST Headers (defines by the
>  * RFC2616) to each request/response.
>  * 
>  * RequestConnControl:	Connection header
>  * RequestTargetHost:	Host header
> */
> ((DefaultHttpClient)client).removeRequestInterceptorByClass(
> 	RequestConnControl.class);
> ((DefaultHttpClient)client).removeRequestInterceptorByClass(
> 	RequestTargetHost.class);

Yep.

Oleg


> -- 
> View this message in context: http://www.nabble.com/HttpClient-4%3A-Disable-Default-Header-tp23162913p23171806.html
> Sent from the HttpClient-User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: HttpClient 4: Disable Default Header

Posted by Taneeda <r....@web.de>.
Hi guys,

I solved this problem now. The solution ist to remove the RequestConnControl
and the RequestTargetHost Interceptor from clients (DefaultHttpClient)
HttpProcessor (BasicHttpProcessor).

/**
 * RequestInterceptors adds MUST Headers (defines by the
 * RFC2616) to each request/response.
 * 
 * RequestConnControl:	Connection header
 * RequestTargetHost:	Host header
*/
((DefaultHttpClient)client).removeRequestInterceptorByClass(
	RequestConnControl.class);
((DefaultHttpClient)client).removeRequestInterceptorByClass(
	RequestTargetHost.class);
-- 
View this message in context: http://www.nabble.com/HttpClient-4%3A-Disable-Default-Header-tp23162913p23171806.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org