aboutsummaryrefslogtreecommitdiffstats
path: root/community/thttpd/forwarded-for.patch
blob: 348eb00cf2b8b63cc3c71d78c3fe73af2f3dc739 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff -Naur old/libhttpd.c new/libhttpd.c
--- old/libhttpd.c	2005-06-30 03:50:39.000000000 +1000
+++ new/libhttpd.c	2012-10-24 12:12:17.144560917 +1100
@@ -2207,6 +2207,12 @@
 		if ( strcasecmp( cp, "keep-alive" ) == 0 )
 		    hc->keep_alive = 1;
 		}
+	    else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 )
+		{
+		cp = &buf[16];
+		cp += strspn( cp, " \t" );
+		inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) );
+		}
 #ifdef LOG_UNKNOWN_HEADERS
 	    else if ( strncasecmp( buf, "Accept-Charset:", 15 ) == 0 ||
 		      strncasecmp( buf, "Accept-Language:", 16 ) == 0 ||