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 Mugoma Joseph Okomba <mu...@yengas.com> on 2012/05/06 05:22:25 UTC

Avoiding HTTP Error 301 when using HttpClient 4.x

Hello,

This relates to
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201205.mbox/browser
(migrating from HC 3 to HC 4).

I can access a link physically in a browser but when I try to access same
link using HttpClient 4 I get HTTP error 301 ("Moved Permanent").

When accessing same link using HttpClient 3 I don't get  HTTP error 301.

What could be causing such anormally? Could it be a setting that I am
missing under HC 4 that makes it behave that way?

Thanks.

Mugoma.


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


Re: Avoiding HTTP Error 301 when using HttpClient 4.x

Posted by Mugoma Joseph Okomba <mu...@yengas.com>.
>>
>>
>
> Post wire logs of both sessions (HC 3.1 and HC 4.1)
>
> Oleg
>

The solution is to set User-Agent header:

 httpClient.getParams().setParameter(AllClientPNames.USER_AGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");

See http://stackoverflow.com/a/10470505/1008916

Many thanks for your assistance.

Mugoma.


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


Re: Avoiding HTTP Error 301 when using HttpClient 4.x

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2012-05-06 at 06:22 +0300, Mugoma Joseph Okomba wrote:
> Hello,
> 
> This relates to
> http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201205.mbox/browser
> (migrating from HC 3 to HC 4).
> 
> I can access a link physically in a browser but when I try to access same
> link using HttpClient 4 I get HTTP error 301 ("Moved Permanent").
> 
> When accessing same link using HttpClient 3 I don't get  HTTP error 301.
> 
> What could be causing such anormally? Could it be a setting that I am
> missing under HC 4 that makes it behave that way?
> 
> Thanks.
> 
> Mugoma.
> 
> 

Post wire logs of both sessions (HC 3.1 and HC 4.1)

Oleg 



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