[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr... |
Date: |
Sun, 23 Feb 2014 18:13:23 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 14/02/23 18:13:23
Modified files:
distrib : ChangeLog
src/networks/bittorrent: bTClients.ml
src/utils/net : http_client.ml http_client.mli
Log message:
patch #8326
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1585&r2=1.1586
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTClients.ml?cvsroot=mldonkey&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/http_client.ml?cvsroot=mldonkey&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/http_client.mli?cvsroot=mldonkey&r1=1.13&r2=1.14
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1585
retrieving revision 1.1586
diff -u -b -r1.1585 -r1.1586
--- distrib/ChangeLog 23 Feb 2014 18:12:25 -0000 1.1585
+++ distrib/ChangeLog 23 Feb 2014 18:13:22 -0000 1.1586
@@ -15,6 +15,7 @@
=========
2014/02/23:
+8326: BT: disable announcing to 127.0.0.1 (ygrek)
8325: do not reset option pause_new_downloads at startup (ygrek)
8324: BT: dump failing UDP tracker packets (ygrek)
8323: Config: fix minor typos (ygrek)
Index: src/networks/bittorrent/bTClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTClients.ml,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- src/networks/bittorrent/bTClients.ml 7 Jul 2013 10:54:48 -0000
1.110
+++ src/networks/bittorrent/bTClients.ml 23 Feb 2014 18:13:22 -0000
1.111
@@ -201,7 +201,10 @@
lprintf_nl "udpt start with %s:%d" host port;
Ip.async_ip host (fun ip ->
(* lprintf_nl "udpt resolved %s to ip %s" host (Ip.to_string ip); *)
- try interact ip with exn -> lprintf_nl "udpt interact exn %s"
(Printexc2.to_string exn))
+ if not (Ip.equal Ip.localhost ip) then
+ try interact ip with exn -> lprintf_nl "udpt interact exn %s"
(Printexc2.to_string exn)
+ else if !verbose_msg_servers then
+ lprintf_nl "udpt ignoring tracker %s (resolves to localhost)" host)
(fun () ->
if !verbose_msg_servers then
lprintf_nl "udpt failed to resolve %s" host)
@@ -339,11 +342,12 @@
let module H = Http_client in
let r = {
H.basic_request with
- H.req_url = Url.of_string ~args: args url;
+ H.req_url = Url.of_string ~args url;
H.req_proxy = !CommonOptions.http_proxy;
H.req_user_agent = get_user_agent ();
(* #4541 [egs] supports redirect *)
H.req_max_retry = !!max_tracker_redirect;
+ H.req_filter_ip = (fun ip -> not (Ip.equal Ip.localhost ip));
} in
if !verbose_msg_servers then
Index: src/utils/net/http_client.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/http_client.ml,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- src/utils/net/http_client.ml 16 Jul 2011 08:59:27 -0000 1.46
+++ src/utils/net/http_client.ml 23 Feb 2014 18:13:22 -0000 1.47
@@ -38,12 +38,13 @@
| DELETE
| TRACE
-type error = [ `HTTP of int | `RST of BasicSocket.close_reason | `DNS ]
+type error = [ `HTTP of int | `RST of BasicSocket.close_reason | `DNS | `Block
of Ip.t ]
let show_error = function
| `HTTP code -> Printf.sprintf "HTTP error code %d" code
| `RST reason -> Printf.sprintf "Connection closed : %s"
(BasicSocket.string_of_reason reason)
| `DNS -> Printf.sprintf "DNS resolution failed"
+| `Block ip -> Printf.sprintf "Blocked connection to %s" (Ip.to_string ip)
let verbose = ref false
@@ -61,6 +62,7 @@
req_max_retry : int;
req_save : bool;
req_max_total_time : float;
+ req_filter_ip : (Ip.t -> bool);
}
type content_handler =
@@ -85,6 +87,7 @@
req_max_retry = 0;
req_save = false;
req_max_total_time = infinite_timeout;
+ req_filter_ip = (fun _ -> true);
}
let make_full_request r =
@@ -245,6 +248,9 @@
in
(* lprintf "async_ip ...\n"; *)
Ip.async_ip server (fun ip ->
+ match r.req_filter_ip ip with
+ | false -> ferr (`Block ip)
+ | true ->
(* lprintf "IP done %s:%d\n" (Ip.to_string ip) port;*)
let token = create_token unlimited_connection_manager in
let sock = TcpBufferedSocket.connect token "http client connecting"
Index: src/utils/net/http_client.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/http_client.mli,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/utils/net/http_client.mli 16 Jul 2011 08:59:28 -0000 1.13
+++ src/utils/net/http_client.mli 23 Feb 2014 18:13:22 -0000 1.14
@@ -47,6 +47,10 @@
req_save : bool;
(** maximum time whole request processing is allowed to take, in seconds *)
req_max_total_time : float;
+ (** this function is called after DNS resolution,
+ returning [false] will block connection to the given ip
+ and HTTP request will fail with `Block error *)
+ req_filter_ip : (Ip.t -> bool);
}
type content_handler =
@@ -55,7 +59,7 @@
val basic_request : request
(** either HTTP error code or low-level network error or DNS *)
-type error = [ `HTTP of int | `RST of BasicSocket.close_reason | `DNS ]
+type error = [ `HTTP of int | `RST of BasicSocket.close_reason | `DNS | `Block
of Ip.t ]
val show_error : error -> string
val get_page : request -> content_handler -> (unit -> unit) -> (error -> unit)
-> unit