-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add an HTTP endopoint to resolve magnet URL to bytes (address #177) #181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ikatson Thank you so much! Looks good! Just a couple of things:
Missing info key
I've tried with a torrent, and the response is:
{
"length": 4932407296,
"name": "ubuntu-23.04-desktop-amd64.iso",
"piece length": 262144,
"pieces": "<hex>OMITTED</hex>"
}
and it should be:
{
"info": {
"length": 4932407296,
"name": "ubuntu-23.04-desktop-amd64.iso",
"piece length": 262144,
"pieces": "<hex>OMITTED</hex>"
}
}
That's the torrent file in JSON format (by using https://chocobo1.github.io/bencode_online/).
Timeout for the endpoint
It seems there is no timeout if the client can't find the torrent. That's not a problem for me because I can't put the timeout in the API client, but it would be good for the server. Some examples: torrust/torrust-index#467
Fixed the first one, please check For the timeout one, there are no timeouts anywhere in HTTP API, so this would be a separate issue / PR |
Hi @ikatson, It works! Just for the record, I'm testing this way: Run the client with: cargo run server start ~/Downloads/TorrentSeeds/ Download the torrent from the magnet link: curl -v --data-raw 'magnet:?xt=urn:btih:443c7602b4fde83d1154d6d9da48808418b181b6' http://localhost:3030/torrents/resolve_magnet > ~/Downloads/Torrents/2024-08-13-ubuntu-23.04-desktop-amd64.iso.torrent The downloaded torrent ( {
"announce": "",
"announce-list": [
[]
],
"info": {
"length": 4932407296,
"name": "ubuntu-23.04-desktop-amd64.iso",
"piece length": 262144,
"pieces": "<hex>OMITTED. TOO BIG</hex>"
}
} |
curl -v --data-raw 'magnet:?...' http://localhost:3030/torrents/resolve_magnet > /tmp/file.torrent