[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/http_s...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/http_s... |
Date: |
Mon, 17 Jul 2006 17:11:55 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/07/17 17:11:55
Modified files:
distrib : ChangeLog
src/utils/net : http_server.ml
Log message:
patch #5243
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.917&r2=1.918
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/http_server.ml?cvsroot=mldonkey&r1=1.29&r2=1.30
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.917
retrieving revision 1.918
diff -u -b -r1.917 -r1.918
--- distrib/ChangeLog 15 Jul 2006 11:52:54 -0000 1.917
+++ distrib/ChangeLog 17 Jul 2006 17:11:54 -0000 1.918
@@ -14,6 +14,9 @@
ChangeLog
=========
+2006/07/17
+5243: HTTP: Print 403 error for requests blocked by allowed_ips
+
2006/07/15
5203: Swarmer: Anti-fragmentation (pango, antifrag_v7)
* Each file is divided into blocks saved in new option
Index: src/utils/net/http_server.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/http_server.ml,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- src/utils/net/http_server.ml 19 May 2006 23:43:55 -0000 1.29
+++ src/utils/net/http_server.ml 17 Jul 2006 17:11:55 -0000 1.30
@@ -20,6 +20,7 @@
open Printf2
open BasicSocket
open TcpBufferedSocket
+open Ip_set
let verbose = ref false
@@ -795,8 +796,6 @@
()
-open Ip_set
-
let handler config t event =
match event with
TcpServerSocket.CONNECTION (s, Unix.ADDR_INET(from_ip, from_port)) ->
@@ -821,6 +820,21 @@
else begin
lprintf_nl "connection from %s rejected (see allowed_ips setting)"
(Ip.to_string from_ip);
+ let token = create_token unlimited_connection_manager in
+ let sock = TcpBufferedSocket.create_simple token "http connection" s in
+ let reject_message = Printf.sprintf
+"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n
+<head><title>403 Forbidden</title></head>\n<h1>Forbidden</h1>\n
+<p>Connection from %s rejected (see downloads.ini, <a
href=\"http://mldonkey.sourceforge.net/Allowed_ips\">allowed_ips</a>)</p>\n
+<hr><address>MLDonkey/%s at %s Port %d</address></html>\n"
+ (Ip.to_string from_ip) Autoconf.current_version
+ (Ip.to_string (TcpBufferedSocket.my_ip sock)) config.port in
+ TcpBufferedSocket.write_string sock (Printf.sprintf
+"HTTP/1.1 403 Forbidden\nMLDonkey/%s\nConnection: close
+Content-Type: text/html; charset=iso-8859-1\nContent-length: %d\r\n"
+ Autoconf.current_version (String.length reject_message));
+ TcpBufferedSocket.write_string sock reject_message;
+ shutdown sock Closed_connect_failed;
Unix.close s
end
| _ -> ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/http_s...,
mldonkey-commits <=