You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "info@flyingfischer.ch" <in...@flyingfischer.ch> on 2017/03/04 12:37:51 UTC

Different results for ContentType with preemptive authentication

httpclient 4.5.3
httpcore 4.4.6

Stumbled over a strange behaviour in the context of preemptive
authentication:

http://files.bakbasel.com/sbp/

It is probably a server bug. If so forget it. As long as you do not send
the correct authentication details, content type will be

"text/html; charset=iso-8859-1"

When sending the correct authentication details, the response will contain

"text/html; charset=none"

which then will throw of course a
java.nio.charset.UnsupportedCharsetException with

final ContentType ct = ContentType.getLenientOrDefault(rp.getEntity());

Thanks for considering, if this is an issue with httpclient. Sorry for
bothering, if this is a server side problem.

Markus



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


Re: Different results for ContentType with preemptive authentication

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
Am 04.03.2017 um 18:36 schrieb Oleg Kalnichevski:
> On Sat, 2017-03-04 at 13:37 +0100, info@flyingfischer.ch wrote:
>> httpclient 4.5.3
>> httpcore 4.4.6
>>
>> Stumbled over a strange behaviour in the context of preemptive
>> authentication:
>>
>> http://files.bakbasel.com/sbp/
>>
>> It is probably a server bug. If so forget it. As long as you do not
>> send
>> the correct authentication details, content type will be
>>
>> "text/html; charset=iso-8859-1"
>>
>> When sending the correct authentication details, the response will
>> contain
>>
>> "text/html; charset=none"
>>
>> which then will throw of course a
>> java.nio.charset.UnsupportedCharsetException with
>>
>> final ContentType ct =
>> ContentType.getLenientOrDefault(rp.getEntity());
>>
>> Thanks for considering, if this is an issue with httpclient. Sorry
>> for
>> bothering, if this is a server side problem.
>>
>> Markus
>>
> Markus
>
> This does look like a server side issue to me but could you please post
> the complete stack trace of the exception?
>
> Oleg
>

java.nio.charset.Charset.forName(Charset.java:531)
org.apache.http.entity.ContentType.create(ContentType.java:248)
org.apache.http.entity.ContentType.create(ContentType.java:238)
org.apache.http.entity.ContentType.get(ContentType.java:323)
org.apache.http.entity.ContentType.getLenientOrDefault(ContentType.java:385)
test.TestCharset.main(TestCharset.java:36)

Logically, because of "text/html; charset=none". Why this happens, I
could not trace.

Very funny: if I send wrong or no authentication at all, the ContentType
is correct. I am using:

httpGet.addHeader(new BasicHeader(HttpHeaders.AUTHORIZATION, "Basic " +
encodedUsernamePassword));

Do not care too long. I did already work around. I suspect a server side
issue too: I never had problems in other situations with preemptive
authentication, but with this host.

Markus






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


Re: Different results for ContentType with preemptive authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2017-03-04 at 13:37 +0100, info@flyingfischer.ch wrote:
> httpclient 4.5.3
> httpcore 4.4.6
> 
> Stumbled over a strange behaviour in the context of preemptive
> authentication:
> 
> http://files.bakbasel.com/sbp/
> 
> It is probably a server bug. If so forget it. As long as you do not
> send
> the correct authentication details, content type will be
> 
> "text/html; charset=iso-8859-1"
> 
> When sending the correct authentication details, the response will
> contain
> 
> "text/html; charset=none"
> 
> which then will throw of course a
> java.nio.charset.UnsupportedCharsetException with
> 
> final ContentType ct =
> ContentType.getLenientOrDefault(rp.getEntity());
> 
> Thanks for considering, if this is an issue with httpclient. Sorry
> for
> bothering, if this is a server side problem.
> 
> Markus
> 

Markus

This does look like a server side issue to me but could you please post
the complete stack trace of the exception?

Oleg

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