Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ikatson
Copy link
Owner

@ikatson ikatson commented Aug 12, 2024

curl -v --data-raw 'magnet:?...' http://localhost:3030/torrents/resolve_magnet > /tmp/file.torrent

Copy link

@josecelano josecelano left a 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

@ikatson
Copy link
Owner Author

ikatson commented Aug 13, 2024

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

@josecelano
Copy link

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 (2024-08-13-ubuntu-23.04-desktop-amd64.iso.torrent) in JSON format (omitting pieces) using https://chocobo1.github.io/bencode_online/:

{
   "announce": "",
   "announce-list": [
      []
   ],
   "info": {
      "length": 4932407296,
      "name": "ubuntu-23.04-desktop-amd64.iso",
      "piece length": 262144,
      "pieces": "<hex>OMITTED. TOO BIG</hex>"
   }
}

@ikatson ikatson merged commit 3cc9e44 into main Aug 13, 2024
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