Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow base64 data parsing to happen under load.raw #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kannibalox
Copy link
Contributor

@kannibalox kannibalox commented Dec 18, 2022

I remarked on this deviation from vanilla rTorrent in #52, but just worked around it since my code already required changes for JSON-RPC anyway.

I remarked on this deviation from vanilla rTorrent jesec#52, but just
worked around it since my code already required changes for JSON-RPC anyway.
kannibalox added a commit to kannibalox/pyrosimple that referenced this pull request Apr 18, 2023
@Elegant996
Copy link

Tested this but saw that it created issues when importing files through torrent clients like flood. May not be necessary?

@kannibalox
Copy link
Contributor Author

kannibalox commented May 24, 2023

The problem isn't that software can't be written to handle the difference (and given that flood is by the same author, of course it'll work), but that it can't be written to handle the difference generically. It breaks from the established method definition of vanilla rtorrent. As an example, I have to do weird protocol checks on a per-function basis in any tools that I write: https://github.com/kannibalox/pyrosimple/blob/main/src/pyrosimple/torrent/rtorrent.py#LL481C1-L481C84, even if it can automatically handle placing binary data in the correct base64 format.

@kannibalox kannibalox changed the title Move base64 data parsing to happen under load.raw Allow base64 data parsing to happen under load.raw Jul 4, 2023
@jesec
Copy link
Owner

jesec commented Jul 4, 2023

To add torrent files with JSON-RPC, we can simply use the regular "load from URL" commands: "load.normal=", "load.start=", etc.

In vanilla rTorrent, you would use those commands for magnet links or HTTP links. This project, however, implemented the "data" URI scheme [1] with 36731c8 .

Use string "data:applications/x-bittorrent;base64,{base64-encoded file}" as param. This should work for XML-RPC as well.

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs

@kannibalox
Copy link
Contributor Author

kannibalox commented Jul 4, 2023

Aha, I grok the intention now. However, I'm still going to push for using data URLs as a generic replacement for the <base64> XMLRPC data type (since JSON-RPC has no equivalent), since the only other option is for clients libraries to do the afore-mentioned protocol checks every time they want to load raw data. I understand that this is pretty theoretical (AFAIK load.raw is the only method that actually uses the <base64> type), and most libraries can probably handle an if statement or two, but it would be much more in line with the vanilla API.

Edit: It was implied, but to state it clearly, load.raw under JSON-RPC is functionally useless without this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants