Browse Source

Perhaps fixes ##370 as it forces the Deluge POST request to be encoded as UTF-8.

pull/406/head
Eric Kok 7 years ago
parent
commit
9f4cf56255
  1. 3
      app/src/main/java/org/transdroid/daemon/Deluge/DelugeAdapter.java

3
app/src/main/java/org/transdroid/daemon/Deluge/DelugeAdapter.java

@ -28,6 +28,7 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.cookie.Cookie; import org.apache.http.cookie.Cookie;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -555,7 +556,7 @@ public class DelugeAdapter implements IDaemonAdapter {
// Set POST URL and data // Set POST URL and data
HttpPost httppost = new HttpPost(buildWebUIUrl() + PATH_TO_RPC); HttpPost httppost = new HttpPost(buildWebUIUrl() + PATH_TO_RPC);
httppost.setHeader("content-type", "application/json"); httppost.setHeader("content-type", "application/json");
StringEntity se = new StringEntity(data.toString()); StringEntity se = new StringEntity(data.toString(), HTTP.UTF_8);
httppost.setEntity(se); httppost.setEntity(se);
// Set session cookie, if it was not in the httpclient object yet // Set session cookie, if it was not in the httpclient object yet

Loading…
Cancel
Save