30 |
int_option 6882 |
int_option 6882 |
31 |
|
|
32 |
(* Generate client_uid *) |
(* Generate client_uid *) |
33 |
let generate_client_uid = |
let generate_client_uid = |
34 |
let client_uid_from_version = "-ML" ^ Autoconf.current_version ^ "-" in |
let client_uid_from_version = "-ML" ^ Autoconf.current_version ^ "-" in |
35 |
let client_uid_random_tail = String.create (20 - (String.length client_uid_from_version)) in |
let client_uid_random_tail = String.create (20 - (String.length client_uid_from_version)) in |
36 |
let sl_client_uid_random_tail = String.length client_uid_random_tail in |
let sl_client_uid_random_tail = String.length client_uid_random_tail in |
44 |
"The UID of this client" Sha1.option (Sha1.direct_of_string generate_client_uid) |
"The UID of this client" Sha1.option (Sha1.direct_of_string generate_client_uid) |
45 |
|
|
46 |
(* Check if the uid is in sync with Autoconf.current_version *) |
(* Check if the uid is in sync with Autoconf.current_version *) |
47 |
let check_client_uid () = |
let check_client_uid () = |
48 |
let s = Sha1.direct_to_string !!client_uid in |
let s = Sha1.direct_to_string !!client_uid in |
49 |
if Autoconf.current_version != String.sub s 3 (( |
if Autoconf.current_version != String.sub s 3 (( |
50 |
try |
try |
51 |
String.index_from s 1 s.[0] |
String.index_from s 1 s.[0] |
52 |
with |
with |
53 |
Not_found -> 3 |
Not_found -> 3 |
54 |
) - 3) then |
) - 3) then |
55 |
client_uid =:= Sha1.direct_of_string generate_client_uid |
client_uid =:= Sha1.direct_of_string generate_client_uid |
104 |
(list_option (tuple2_option (string_option, list_option (tuple2_option (string_option, string_option))))) [] |
(list_option (tuple2_option (string_option, list_option (tuple2_option (string_option, string_option))))) [] |
105 |
|
|
106 |
let referers = define_option bittorrent_section ["referers"] |
let referers = define_option bittorrent_section ["referers"] |
107 |
"Referer sent with http request to get .torrent file" |
"Referer sent with http request to get .torrent file" |
108 |
(list_option (tuple2_option (string_option, string_option))) [(".*suprnova.*", "http://www.suprnova.org/")] |
(list_option (tuple2_option (string_option, string_option))) [(".*suprnova.*", "http://www.suprnova.org/")] |
109 |
|
|