org.apache.http.client.ClientProtocolException

落花浮王杯 提交于 2019-11-30 07:02:18

the problem was the Authorization header.

We have to use:

httpGet.addHeader("Authorization", "Basic "+Base64.encodeToString("rat#1:rat".getBytes(),Base64.NO_WRAP));

Instead of:

httpGet.addHeader("Authorization", "Basic "+Base64.encodeToString("rat#1:rat".getBytes(),Base64.DEFAULT));

because the DEFAULT parameter add "CR" line terminator at the end of string and it's uncorrect if you'll use it that header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!