mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Add key parameter to the tracker announce URI
If non-empty it will be sent to the tracker. A short description of the purpose: * key: Optional. An additional identification that is not shared with any users. It is intended to allow a client to prove their identity should their IP address change. Reported by Toksyuryel.
This commit is contained in:
parent
f35026ecfb
commit
b2c1af1611
src/protocol/bittorrent
@ -70,6 +70,14 @@ static struct option_info bittorrent_protocol_options[] = {
|
||||
"no IP address will be sent and the tracker will automatically\n"
|
||||
"determine an appropriate IP address.")),
|
||||
|
||||
INIT_OPT_STRING("protocol.bittorrent.tracker", N_("User identification string"),
|
||||
"key", 0, "",
|
||||
N_("An additional identification that is not shared with any users.\n"
|
||||
"It is intended to allow a client to prove their identity should\n"
|
||||
"their IP address change. It is an optional parameter, but some\n"
|
||||
"trackers require this parameter. If set to \"\" no user key will\n"
|
||||
"be sent to the tracker.")),
|
||||
|
||||
INIT_OPT_INT("protocol.bittorrent.tracker", N_("Maximum number of peers to request"),
|
||||
"numwant", 0, 0, INT_MAX, 50,
|
||||
N_("The maximum number of peers to request from the tracker.\n"
|
||||
|
@ -140,7 +140,7 @@ do_send_bittorrent_tracker_request(struct connection *conn)
|
||||
{
|
||||
struct bittorrent_connection *bittorrent = conn->info;
|
||||
int stopped = (bittorrent->tracker.event == BITTORRENT_EVENT_STOPPED);
|
||||
unsigned char *ip;
|
||||
unsigned char *ip, *key;
|
||||
struct string request;
|
||||
struct uri *uri = NULL;
|
||||
int numwant, index, min_size;
|
||||
@ -193,6 +193,12 @@ do_send_bittorrent_tracker_request(struct connection *conn)
|
||||
/* This one is required for each request. */
|
||||
add_format_to_string(&request, "&port=%u", bittorrent->port);
|
||||
|
||||
key = get_opt_str("protocol.bittorrent.tracker.key");
|
||||
if (*key) {
|
||||
add_to_string(&request, "&key=", key);
|
||||
encode_uri_string(&request, key, strlen(key), 1);
|
||||
}
|
||||
|
||||
if (bittorrent->tracker.event != BITTORRENT_EVENT_REGULAR) {
|
||||
unsigned char *event;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user