org.apache.http.client.ClientProtocolException

后端 未结 1 641
無奈伤痛
無奈伤痛 2020-12-30 08:24

I\'ve made an Android application that uses a X509 certificate (that is in the folder res/raw/mykeystore.bks) to sign to remote server that respond on the 9006 port.

相关标签:
1条回答
  • 2020-12-30 08:45

    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.

    0 讨论(0)
提交回复
热议问题