1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

In r377229, the REAL_IP patch from NginX was added that puts X-Forwarded-For

into Remote-Addr.  That cripples IPv6 ready software to IPv4 only, let's try
to fix this.

PR:		230382
Submitted by:	bz
This commit is contained in:
Alexey Dokuchaev 2020-02-11 07:07:14 +00:00
parent f568e81522
commit cbf5691e0f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=525787
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= thttpd
PORTVERSION= 2.29
PORTREVISION= 1
CATEGORIES= www
MASTER_SITES= http://www.acme.com/software/thttpd/

View File

@ -1,6 +1,6 @@
--- libhttpd.c.orig 2003-12-25 20:06:05.000000000 +0100
+++ libhttpd.c 2005-01-09 00:26:04.867255248 +0100
@@ -2207,6 +2207,12 @@
@@ -2207,6 +2207,18 @@
if ( strcasecmp( cp, "keep-alive" ) == 0 )
hc->keep_alive = 1;
}
@ -8,6 +8,12 @@
+ { // Use real IP if available
+ cp = &buf[16];
+ cp += strspn( cp, " \t" );
+#ifdef USE_IPV6
+ if (strchr(cp, '.') == NULL)
+ inet_pton( AF_INET6, cp,
+ &(hc->client_addr.sa_in6.sin6_addr) );
+ else
+#endif
+ inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) );
+ }
#ifdef LOG_UNKNOWN_HEADERS