Skip to content

Conversation

@milahu
Copy link

@milahu milahu commented Jun 21, 2025

implement bittorrent/bittorrent.org#171

status: early draft

i need help to get from "parse magnet link with xs parameter" to "send http request to fetch metadata file"
should the http server be treated like a bittorrent peer?

so far, i tried to base exact_source_connection on web_connection_base (which is based on peer_connection)
but it should be based on http_connection (right?)
but i dont see where i should create the http_connection

i need "dont require files_checked to connect to webseeds" to reach my code
files_checked makes no sense when we have no metadata

currently the parser fails at

[1027] xxxxxxxxxxxxxxx peer [ 127.0.0.1:80 client: Unknown [ .]....S....i.|.....] ] [127.0.0.1:80] <<< exact_source_connection::on_receive [ loop step: m_parser.status_code() == -1 ]

this looks like exact_source_connection::m_parser is not an http parser...?
because recv_buffer contains a valid http response

HTTP/1.1 200 OK
Content-Length: 800
Connection: keep-alive

d8:announce30:udp://...

exact_source_connection examples:

./examples/exact_source_client "magnet:?xt=urn:btih:xxxxxxxxxxxxxxx&xs=http://127.0.0.1/cas/btih/xxxxxxxxxxxxxxx.torrent"
./examples/exact_source_client "magnet:?xt=urn:btih:xxxxxxxxxxxxxxx&cas=http://127.0.0.1/cas/"

this requires an http server on 127.0.0.1
serving metadata and content files under http://127.0.0.1/cas/

http://127.0.0.1/cas/btih/xxxxxxxxxxxxxxx.torrent
http://127.0.0.1/cas/btih/xxxxxxxxxxxxxxx/Some.Dir/Some.File.txt

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.

1 participant