File: apachesrc.diff

package info (click to toggle)
libapache-mod-limitipconn 0.04-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 72 kB
  • ctags: 34
  • sloc: ansic: 171; makefile: 12
file content (111 lines) | stat: -rw-r--r-- 4,855 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff -ur apache_1.3.24.orig/configure apache_1.3.24/configure
--- apache_1.3.24.orig/configure	Wed Mar 13 16:05:27 2002
+++ apache_1.3.24/configure	Fri Apr 12 01:23:28 2002
@@ -454,6 +454,7 @@
             echo " --without-execstrip    disable the stripping of executables on installation"
             echo " --server-uid=UID       set the user ID the web server should run as [nobody]"
             echo " --server-gid=GID       set the group ID the web server UID is a memeber of [#-1]"
+            echo " --with-forward         enable tracking of cache-forwarded requests"
             echo ""
             echo "suEXEC options:"
             echo " --enable-suexec        enable the suEXEC feature"
@@ -961,6 +962,10 @@
         --with-port=*)
             port="$apc_optarg"
             ;;
+        --with-forward)
+            forward=1
+            CFLAGS="$CFLAGS -DRECORD_FORWARD"
+            ;;
         --without-support)
             support=0
             ;;
diff -ur apache_1.3.24.orig/src/include/scoreboard.h apache_1.3.24/src/include/scoreboard.h
--- apache_1.3.24.orig/src/include/scoreboard.h	Wed Mar 13 16:05:29 2002
+++ apache_1.3.24/src/include/scoreboard.h	Fri Apr 12 01:23:28 2002
@@ -158,6 +158,9 @@
     time_t last_used;
 #endif
     char client[32];		/* Keep 'em small... */
+#ifdef RECORD_FORWARD
+    char fwdclient[32];     /* Client that the req is forwarded for */
+#endif
     char request[64];		/* We just want an idea... */
     server_rec *vhostrec;	/* What virtual host is being accessed? */
                                 /* SEE ABOVE FOR SAFE USAGE! */
diff -ur apache_1.3.24.orig/src/main/http_main.c apache_1.3.24/src/main/http_main.c
--- apache_1.3.24.orig/src/main/http_main.c	Wed Mar 13 16:05:30 2002
+++ apache_1.3.24/src/main/http_main.c	Fri Apr 12 01:23:28 2002
@@ -2561,6 +2561,9 @@
 {
     int old_status;
     short_score *ss;
+#ifdef RECORD_FORWARD
+    char * address;
+#endif
 
     if (child_num < 0)
 	return -1;
@@ -2598,6 +2601,15 @@
 	    conn_rec *c = r->connection;
 	    ap_cpystrn(ss->client, ap_get_remote_host(c, r->per_dir_config,
 				  REMOTE_NOLOOKUP), sizeof(ss->client));
+
+#ifdef RECORD_FORWARD
+        if ((address = ap_table_get(r->headers_in, "X-Forwarded-For")) == NULL) {
+            ap_cpystrn(ss->fwdclient, "", sizeof(ss->client));
+        } else {
+            ap_cpystrn(ss->fwdclient, address, sizeof(ss->client));
+        } 
+#endif
+
 	    if (r->the_request == NULL) {
 		    ap_cpystrn(ss->request, "NULL", sizeof(ss->request));
 	    } else if (r->parsed_uri.password == NULL) {
diff -ur apache_1.3.24.orig/src/modules/standard/mod_status.c apache_1.3.24/src/modules/standard/mod_status.c
--- apache_1.3.24.orig/src/modules/standard/mod_status.c	Wed Mar 13 16:05:34 2002
+++ apache_1.3.24/src/modules/standard/mod_status.c	Fri Apr 12 01:23:28 2002
@@ -486,9 +486,17 @@
 	    else
 #ifdef NO_TIMES
 		/* Allow for OS/2 not having CPU stats */
+#ifdef RECORD_FORWARD
+		ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client (Fwd)<th>VHost<th>Request</tr>\n\n", r);
+#else
 		ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
+#endif // RECORD_FORWARD
+#else
+#ifdef RECORD_FORWARD
+		ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client (Fwd)<th>VHost<th>Request</tr>\n\n", r);
 #else
 		ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
+#endif // RECORD_FORWARD
 #endif
 	}
 
@@ -673,13 +681,18 @@
 			if (score_record.status == SERVER_BUSY_READ)
 			    ap_rprintf(r,
 			     "<td>?<td nowrap>?<td nowrap>..reading.. </tr>\n\n");
-			else
-			    ap_rprintf(r,
-			     "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
-			     ap_escape_html(r->pool, score_record.client),
-			     vhost ? ap_escape_html(r->pool, 
-				vhost->server_hostname) : "(unavailable)",
-			     ap_escape_html(r->pool, score_record.request));
+			else {
+                ap_rprintf(r,"<td>%s",ap_escape_html(r->pool, score_record.client));
+#ifdef RECORD_FORWARD
+                if (strlen(score_record.fwdclient) != 0)
+			    ap_rprintf(r,
+                               " (%s)", ap_escape_html(r->pool, score_record.fwdclient));
+#endif
+			    ap_rprintf(r, "<td nowrap>%s<td nowrap>%s</tr>\n\n",
+                           vhost ? ap_escape_html(r->pool, vhost->server_hostname) : "(unavailable)",
+                           ap_escape_html(r->pool, score_record.request));
+
+            } /* if (! score_record.status == SERVER_BUSY_READ) */
 		    }		/* no_table_report */
 		}			/* !short_report */
 	    }			/* if (<active child>) */