rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
885 stars 209 forks source link

Add support for webseeds #164

Open naf419 opened 6 years ago

naf419 commented 6 years ago

Initial attempt.

I tried to follow the psuedo-spec at http://getright.com/seedtorrent.html

(Barely) Tested against archive.org samples.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.2%) to 18.207% when pulling b27e5e69c701e227122372458c499ef6a67b0ab9 on naf419:webseed into c167c5a9e0bcf0df23ae5efd91396aae0e37eb87 on rakshasa:master.

chros73 commented 6 years ago

Looks interesting! Let me know when you feel it'ts ready to be tested and I'll include it in rtorrent-ps-ch on a branch to be able to test it and I'll post on the original issue.

@rakshasa , this one needs your guidance. :)

@naf419, Thank you for your work!

naf419 commented 6 years ago

@chros73, well before you try it, let me tell you what i think it does:

it should:

it wont:

given that, if you'd like to test it, have at it.

chros73 commented 6 years ago

Thanks for the detailed comment. Do youbplan to modify the functionalty further or this is the last take?

naf419 commented 6 years ago

@chros73 no planned functionality changes

chros73 commented 6 years ago

I couldn't compile libtorrent :( :

I couldn't find the cause of the issue "quickly". I don't/won't have time to "play" with it in the near future, sorry. If I managed to figure out something I'll let you know. Thanks for your work!

chros73 commented 6 years ago

I played with it today and managed to compile it:

I had to add back setting CPPFLAGS into build script, otherwise the include CFLAGS doesn't get passed to libtool for some reason that I still don't understand why:

chros73 commented 6 years ago

So, I tried out with an archive.org torrent and it seems to be working, but when I tried to create my own (creating with utorrent 2.2.1) it didn't download it. Have you tried it with your own torrent file?

And does it deal with multi/single-file torrents as well, e.g. as in transmission?

it won't honor the max download choke speed

Probably you meant throttle groups, and not choke groups. It'd be nice if:

naf419 commented 6 years ago

@chros73 i made some torrents myself and you are right about it not working. i only handled when multiple urls were present. and i didn't handle url's not ending with a / for single-torrent files. fix coming shortly.

chros73 commented 6 years ago

Thanks for the update, I also updated my branch with it.

I've attached torrent files to try out with, let's use this URL for testing (we can create lot of type of torrents from it, and they are small files):

A. It properly throws error to the log console if:

B. It's working with single file torrents:

C. I'm not sure about multi file torrents, what URL do we have to use in these cases? I created torrents from this content:

Impressive work, @naf419 ! :)

naf419 commented 6 years ago

@chros73 according to my reading of the getright spec, url-list entries can either be: http://srv/folder/filename <-- no trailing / or http://srv/folder/ <-- trailing /, so torrent name appended to url

multi-file torrents files follow the same rule, but also add the sub-file name to the end of the url.

your TP-LINK-TL-WR842N-ND-V2.torrent didnt work because it ends in a slash, but already has the torrent name included in the url prefix. you used (my interpretation of) the correct url in the other 2 multi-file torrents by removing the torrent name.

ETA: strangely, the url you wrote above would have worked, but the actual url in the torrent had a trailing /

chros73 commented 6 years ago

Errr, that webseed url doesn't have a trailing slash.... Or am I mistaken?

naf419 commented 6 years ago

Ya, the one that didn't work for you had a trailing slash. Should have been like this (the url you wrote without the /) TP-LINK-TL-WR842N-ND-V2-corrected.zip

chros73 commented 6 years ago

You were right, sorry (I haven't looked in the generated torrent file): utorrent 2.2.1 added the trailing slash. :( It works indeed fine after editing the file manually. (I also updated my above comments.)

So, it seems all the URL related issues are good now. What happens if there are other seeders in the swarm? Will webseed be used?

A. I suggest to modify configure.ac:

B. Although a lot still has to be done if you (we) want this to get merged. :(

May I suggest to go through the web. and webseed. files of transmission and "steal" ideas to use in your tracker/controller, e.g. like this?

I think these classes have to be finished first and then the rest of the integration can be dealt with.

Thanks for your work!

naf419 commented 6 years ago

What happens if there are other seeders in the swarm? Will webseed be used?

Yes, it gets the next desired chunk from the same pool of desired chunks as the peer requests do, so it should [untested] work fine in simultaneous cooperation with other seeding peers.

RE: merge, i don't imagine it ever will, I just threw it up here for anyone who wanted to patch it in themselves