Browse Source

Increase size of the rTorrent set_xmlrpc_size_limit to better reflect the real request size whil not having to encode the string twice. Sicne Base64-encoded content is about 1.37 time larger than the original byte strea, a multiplication of 2 is roomy enough (while small files fit in the default max request size anyway, so the Base64 header is no problem).

pull/148/merge
Eric Kok 11 years ago
parent
commit
4d81131e1d
  1. 25
      core/src/org/transdroid/core/gui/TorrentsActivity.java
  2. 5
      lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

25
core/src/org/transdroid/core/gui/TorrentsActivity.java

@ -44,31 +44,18 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.impl.cookie.BasicClientCookie;
import org.transdroid.core.R; import org.transdroid.core.R;
import org.transdroid.core.app.search.SearchHelper_; import org.transdroid.core.app.search.*;
import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.*;
import org.transdroid.core.app.settings.ServerSetting;
import org.transdroid.core.app.settings.SystemSettings;
import org.transdroid.core.app.settings.SystemSettings_;
import org.transdroid.core.app.settings.WebsearchSetting;
import org.transdroid.core.gui.lists.LocalTorrent; import org.transdroid.core.gui.lists.LocalTorrent;
import org.transdroid.core.gui.lists.NoProgressHeaderTransformer; import org.transdroid.core.gui.lists.NoProgressHeaderTransformer;
import org.transdroid.core.gui.lists.SimpleListItem; import org.transdroid.core.gui.lists.SimpleListItem;
import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.log.*;
import org.transdroid.core.gui.log.Log_; import org.transdroid.core.gui.navigation.*;
import org.transdroid.core.gui.navigation.FilterListAdapter; import org.transdroid.core.gui.rss.*;
import org.transdroid.core.gui.navigation.FilterListAdapter_;
import org.transdroid.core.gui.navigation.FilterListDropDownAdapter;
import org.transdroid.core.gui.navigation.FilterListDropDownAdapter_;
import org.transdroid.core.gui.navigation.Label;
import org.transdroid.core.gui.navigation.NavigationFilter;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.gui.navigation.RefreshableActivity;
import org.transdroid.core.gui.navigation.StatusType;
import org.transdroid.core.gui.rss.RssfeedsActivity_;
import org.transdroid.core.gui.search.BarcodeHelper; import org.transdroid.core.gui.search.BarcodeHelper;
import org.transdroid.core.gui.search.FilePickerHelper; import org.transdroid.core.gui.search.FilePickerHelper;
import org.transdroid.core.gui.search.UrlEntryDialog; import org.transdroid.core.gui.search.UrlEntryDialog;
import org.transdroid.core.gui.settings.MainSettingsActivity_; import org.transdroid.core.gui.settings.*;
import org.transdroid.core.service.BootReceiver; import org.transdroid.core.service.BootReceiver;
import org.transdroid.core.service.ConnectivityHelper; import org.transdroid.core.service.ConnectivityHelper;
import org.transdroid.core.widget.ListWidgetProvider; import org.transdroid.core.widget.ListWidgetProvider;

5
lib/src/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -33,7 +33,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.base64.android.Base64;
import org.transdroid.daemon.Daemon; import org.transdroid.daemon.Daemon;
import org.transdroid.daemon.DaemonException; import org.transdroid.daemon.DaemonException;
import org.transdroid.daemon.DaemonException.ExceptionType; import org.transdroid.daemon.DaemonException.ExceptionType;
@ -66,8 +65,8 @@ import org.transdroid.daemon.util.DLog;
import org.transdroid.daemon.util.HttpHelper; import org.transdroid.daemon.util.HttpHelper;
import de.timroes.axmlrpc.XMLRPCClient; import de.timroes.axmlrpc.XMLRPCClient;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLRPCClient.UnauthorizdException; import de.timroes.axmlrpc.XMLRPCClient.UnauthorizdException;
import de.timroes.axmlrpc.XMLRPCException;
/** /**
* An adapter that allows for easy access to rTorrent torrent data. Communication * An adapter that allows for easy access to rTorrent torrent data. Communication
@ -122,7 +121,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
baos.write(buffer, 0, read); baos.write(buffer, 0, read);
} }
byte[] bytes = baos.toByteArray(); byte[] bytes = baos.toByteArray();
int size = Base64.encodeBytes(bytes).length(); int size = (int) file.length() * 2;
final int XMLRPC_EXTRA_PADDING = 1280; final int XMLRPC_EXTRA_PADDING = 1280;
makeRtorrentCall("set_xmlrpc_size_limit", new Object[] { size + XMLRPC_EXTRA_PADDING }); makeRtorrentCall("set_xmlrpc_size_limit", new Object[] { size + XMLRPC_EXTRA_PADDING });
makeRtorrentCall("load_raw_start", new Object[] { bytes }); makeRtorrentCall("load_raw_start", new Object[] { bytes });

Loading…
Cancel
Save