hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "info@flyingfischer.ch" <i...@flyingfischer.ch>
Subject Re: Different results for ContentType with preemptive authentication
Date Sat, 04 Mar 2017 18:26:08 GMT
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


Mime
View raw message