我们有一个应用程序通过https连接到我们的网站,我们已将公司或托管公司更改为one.com,现在使用了免费的ssl系统,但是该应用程序不再起作用。
我们使用glide加载图像,使用okhttp进行所有网络连接(使用glide进行连接),但是okhttp3似乎无法与one.com提供的https连接一起使用。经过一番搜索之后,似乎okhttp不支持sni,我是否需要为此做些准备?
Mvg。克里斯多夫VD 代码:
public String makeServiceCall(String reqUrl, Context con, String uitbreiding) {
context = con;
DB = new DatabaseVerwerker(context); //<-- database verbinden
String output = null;
if(reqUrl.toLowerCase().contains("?")) {
reqUrl = reqUrl + "&key=" + DB.GetVar(DB, "authkey", "null") + uitbreiding;
} else {
reqUrl = reqUrl + "?key=" + DB.GetVar(DB, "authkey", "null") + uitbreiding;
}
try {
OkHttpClient client = new OkHttpClient();
client = new OkHttpClient.Builder().build();
FormBody.Builder formBuilder = new FormBody.Builder();
//formBuilder.add("phone", "000000");
RequestBody formBody = formBuilder.build();
Log.v("JsonRespons", reqUrl);
Request request = new Request.Builder()
.url(reqUrl)
.addHeader("Content-Type", " application/x-www-form-urlencoded")
.post(formBody)
.build();
okhttp3.Response response = null;
response = client.newCall(request).execute();
Log.v("JsonFulRespons", response.toString());
if (!response.isSuccessful()) {
throw new IOException(response.message() + " " + response.toString());
} else {
output = response.body().string();
Log.v("JsonFulRespons", response.toString());
}
} catch (IOException e) {
e.printStackTrace();
}
Log.v("JsonRespons", output.toString());
return output;
}