[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co... |
Date: |
Sun, 07 Jul 2013 11:07:14 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 13/07/07 11:07:14
Modified files:
distrib : ChangeLog
src/daemon/common: commonOptions.ml
src/daemon/driver: driverCommands.ml driverControlers.ml
Log message:
patch #8111
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1577&r2=1.1578
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.242&r2=1.243
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.267&r2=1.268
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverControlers.ml?cvsroot=mldonkey&r1=1.122&r2=1.123
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1577
retrieving revision 1.1578
diff -u -b -r1.1577 -r1.1578
--- distrib/ChangeLog 7 Jul 2013 11:04:11 -0000 1.1577
+++ distrib/ChangeLog 7 Jul 2013 11:07:13 -0000 1.1578
@@ -15,6 +15,7 @@
=========
2013/07/07:
+8111: http: New option http_root_url specifies root url for the web interface
(ygrek)
8113: IP discover: Fix broken URL
8112: BT/HTML: select/unselect whole directories in BT multifile downloads
(ygrek)
8110: http_server: refactor error_page (ygrek)
Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -b -r1.242 -r1.243
--- src/daemon/common/commonOptions.ml 24 Jun 2012 08:09:07 -0000 1.242
+++ src/daemon/common/commonOptions.ml 7 Jul 2013 11:07:13 -0000 1.243
@@ -507,6 +507,10 @@
"port for user interaction, 0 to deactivate telnet interface"
port_option 4000
+let http_root_url = define_expert_option current_section ["http_root_url"]
+ "Root url for the http interface (makes http proxy setup in front of
mldonkey easier)"
+ string_option "/"
+
let http_bind_addr = define_expert_option current_section ["http_bind_addr"]
~restart: true
"The IP address used to bind the http server"
Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.267
retrieving revision 1.268
diff -u -b -r1.267 -r1.268
--- src/daemon/driver/driverCommands.ml 7 Jul 2013 11:03:33 -0000 1.267
+++ src/daemon/driver/driverCommands.ml 7 Jul 2013 11:07:13 -0000 1.268
@@ -2005,6 +2005,7 @@
strings_of_option gui_port;
strings_of_option telnet_port;
strings_of_option http_port;
+ strings_of_option http_root_url;
strings_of_option http_realm;
strings_of_option allowed_ips;
]
Index: src/daemon/driver/driverControlers.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -b -r1.122 -r1.123
--- src/daemon/driver/driverControlers.ml 7 Jul 2013 11:01:42 -0000
1.122
+++ src/daemon/driver/driverControlers.ml 7 Jul 2013 11:07:13 -0000
1.123
@@ -953,7 +953,20 @@
CommonInteractive.display_vd := false;
CommonInteractive.display_bw_stats := false;
clear_page buf;
- if !Http_server.verbose && r.get_url.Url.short_file <> "" then
+ let short_file =
+ let file = r.get_url.Url.short_file in
+ match !!http_root_url with
+ | "" | "/" -> `File file
+ | root ->
+ let root = if not (String2.starts_with root "/") then "/" ^ root else
root in
+ (* we want to treat "/root" requests as invalid and redirect them to
"/root/" *)
+ let root_dir = if root <> "" && root.[String.length root - 1] = '/' then
root else root ^ "/" in
+ if String2.starts_with ("/"^file) root_dir then
+ `File (String2.after file (String.length root_dir - 1))
+ else
+ `Redirect root_dir
+ in
+ if !Http_server.verbose && short_file <> `File "" then
lprintf_nl "received URL %s %s"
r.get_url.Url.short_file
(let b = Buffer.create 100 in
@@ -961,7 +974,7 @@
if Buffer.contents b <> "" then Printf.sprintf "(%s)" (Buffer.contents
b) else "");
let user = if r.options.login = "" then (admin_user
()).CommonTypes.user_name else r.options.login in
- if not (valid_password user r.options.passwd) || (r.get_url.Url.short_file =
"logout") then begin
+ if not (valid_password user r.options.passwd) || (short_file = `File
"logout") then begin
clear_page buf;
http_file_type := HTM;
let _, error_text_long, head = Http_server.error_page Unauthorized
(TcpBufferedSocket.my_ip r.sock) !!http_port in
@@ -981,7 +994,18 @@
user.ui_http_conn <- Some oo; oo
in
try
- match r.get_url.Url.short_file with
+ match short_file with
+ | `Redirect url ->
+ let _, error_text_long, head = Http_server.error_page (Moved url)
+ (TcpBufferedSocket.my_ip r.sock)
+ !!http_port
+ in
+ r.reply_head <- head;
+ add_reply_header r "Location" url;
+ http_add_html_header r;
+ Buffer.add_string buf error_text_long
+ | `File short_file ->
+ match short_file with
| "wap.wml" ->
begin
clear_page buf;