1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Allow http for LanguageTool (2)

This commit is contained in:
M66B 2023-02-23 19:13:06 +01:00
parent 400f6d1a79
commit fb9696d538

View file

@ -50,8 +50,6 @@ import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.HttpsURLConnection;
public class LanguageTool {
static final String LT_URI = "https://api.languagetool.org/v2/";
static final String LT_URI_PLUS = "https://api.languagetoolplus.com/v2/";
@ -82,7 +80,7 @@ public class LanguageTool {
Log.i("LT uri=" + uri);
URL url = new URL(uri.toString());
HttpURLConnection connection = (HttpsURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(false);
connection.setReadTimeout(LT_TIMEOUT * 1000);
@ -243,7 +241,7 @@ public class LanguageTool {
Log.i("LT uri=" + uri + " request=" + request);
URL url = new URL(uri.toString());
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setReadTimeout(LT_TIMEOUT * 1000);
@ -319,7 +317,7 @@ public class LanguageTool {
Log.i("LT uri=" + uri + " request=" + request);
URL url = new URL(uri.toString());
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setReadTimeout(LT_TIMEOUT * 1000);
@ -370,7 +368,7 @@ public class LanguageTool {
Log.i("LT uri=" + uri);
URL url = new URL(uri.toString());
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(false);
connection.setReadTimeout(LT_TIMEOUT * 1000);
@ -436,7 +434,7 @@ public class LanguageTool {
private static void checkStatus(HttpURLConnection connection) throws IOException {
int status = connection.getResponseCode();
if (status != HttpsURLConnection.HTTP_OK) {
if (status != HttpURLConnection.HTTP_OK) {
String error = "Error " + status + ": " + connection.getResponseMessage();
try {
InputStream is = connection.getErrorStream();