Android Https Status code -1

前端 未结 1 1915
温柔的废话
温柔的废话 2020-12-18 12:56

I\'m connecting to a web server from my android application via HttpsUrlConnection or HttpUrlConnection depending on settings. For now I didn\'t ha

相关标签:
1条回答
  • 2020-12-18 13:25

    HTTP response code -1, means that something went wrong with connection or response handling. The HttpURLConnection in often buggy with keeping connections alive.

    If you want to turn if off, you have to set the http.keepAlive system property into false.

    The way to do this programmatically is putting this at the beginning of your application:

    System.setProperty("http.keepAlive", "false");
    
    0 讨论(0)
提交回复
热议问题