* [gentoo-commits] gentoo-x86 commit in www-servers/thttpd/files: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch thttpd-2.25b-fix-illegal-path-info.patch thttpd-2.25b-use-X-Forwarded-For-header.patch thttpd-2.25b-monolithic-timer.patch thttpd-2.25b-use-Status-header.patch
@ 2010-10-28 22:25 Thilo Bangert (bangert)
0 siblings, 0 replies; only message in thread
From: Thilo Bangert (bangert) @ 2010-10-28 22:25 UTC (permalink / raw
To: gentoo-commits
bangert 10/10/28 22:25:24
Added: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch
thttpd-2.25b-fix-illegal-path-info.patch
thttpd-2.25b-use-X-Forwarded-For-header.patch
thttpd-2.25b-monolithic-timer.patch
thttpd-2.25b-use-Status-header.patch
Log:
Bump. EAPI=3, dont freeze when time goes backwards (#327615), dont link
statically by default (#273319), respect CFLAGS (#241464), fix illegal
PATH_INFO, use Status on all Location headers, use IP from
X-Forwarded-For (all #331747).
(Portage version: 2.2_rc99/cvs/Linux i686)
Revision Changes Path
1.1 www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch?rev=1.1&content-type=text/plain
Index: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch
===================================================================
diff -Naur thttpd-2.25b.orig/cgi-src/Makefile.in thttpd-2.25b/cgi-src/Makefile.in
--- thttpd-2.25b.orig/cgi-src/Makefile.in 2010-10-28 23:33:28.000000000 +0200
+++ thttpd-2.25b/cgi-src/Makefile.in 2010-10-29 00:05:43.000000000 +0200
@@ -31,10 +31,9 @@
MANDIR = @mandir@
CC = @CC@
-CCOPT = @V_CCOPT@
DEFS = @DEFS@
INCLS = -I..
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
+CFLAGS += $(DEFS) $(INCLS)
LDFLAGS = @LDFLAGS@ @V_STATICFLAG@
LIBS = @LIBS@
NETLIBS = @V_NETLIBS@
diff -Naur thttpd-2.25b.orig/extras/Makefile.in thttpd-2.25b/extras/Makefile.in
--- thttpd-2.25b.orig/extras/Makefile.in 2010-10-28 23:33:28.000000000 +0200
+++ thttpd-2.25b/extras/Makefile.in 2010-10-29 00:06:36.000000000 +0200
@@ -32,11 +32,9 @@
MANDIR = @mandir@
CC = @CC@
-CCOPT = @V_CCOPT@
DEFS = @DEFS@
INCLS = -I..
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
-STATICFLAG = @V_STATICFLAG@
+CFLAGS += $(DEFS) $(INCLS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
NETLIBS = @V_NETLIBS@
@@ -59,7 +57,7 @@
$(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c makeweb.c
htpasswd: htpasswd.o
- $(CC) $(LDFLAGS) $(STATICFLAG) htpasswd.o -o htpasswd $(LIBS)
+ $(CC) $(LDFLAGS) htpasswd.o -o htpasswd $(LIBS)
htpasswd.o: htpasswd.c ../config.h
$(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c htpasswd.c
diff -Naur thttpd-2.25b.orig/Makefile.in thttpd-2.25b/Makefile.in
--- thttpd-2.25b.orig/Makefile.in 2010-10-28 23:33:28.000000000 +0200
+++ thttpd-2.25b/Makefile.in 2010-10-29 00:05:43.000000000 +0200
@@ -47,10 +47,9 @@
# You shouldn't need to edit anything below here.
CC = @CC@
-CCOPT = @V_CCOPT@
DEFS = @DEFS@
INCLS = -I.
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
+CFLAGS += $(DEFS) $(INCLS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
NETLIBS = @V_NETLIBS@
1.1 www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch?rev=1.1&content-type=text/plain
Index: thttpd-2.25b-fix-illegal-path-info.patch
===================================================================
diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c
--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:55.000000000 +0000
+++ thttpd-2.25b/libhttpd.c 2007-10-14 10:09:11.000000000 +0000
@@ -2322,8 +2320,11 @@
{
int i;
i = strlen( hc->origfilename ) - strlen( hc->pathinfo );
- if ( i > 0 && strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 )
- hc->origfilename[i - 1] = '\0';
+ if ( strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 )
+ {
+ if ( i == 0 ) hc->origfilename[0] = '\0';
+ else hc->origfilename[i - 1] = '\0';
+ }
}
/* If the expanded filename is an absolute path, check that it's still
1.1 www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch?rev=1.1&content-type=text/plain
Index: thttpd-2.25b-use-X-Forwarded-For-header.patch
===================================================================
--- thttpd-2.25b/libhttpd.c 2003-12-25 20:06:05.000000000 +0100
+++ thttpd-2.25b-patched/libhttpd.c 2005-01-09 00:26:04.867255248 +0100
@@ -2207,6 +2207,12 @@
if ( strcasecmp( cp, "keep-alive" ) == 0 )
hc->keep_alive = 1;
}
+ else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 )
+ { // Use real IP if available
+ 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 ||
1.1 www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch?rev=1.1&content-type=text/plain
Index: thttpd-2.25b-monolithic-timer.patch
===================================================================
diff -Nru thttpd-2.25b.orig/configure.in thttpd-2.25b/configure.in
--- thttpd-2.25b.orig/configure.in 2003-12-25 20:41:13.000000000 +0200
+++ thttpd-2.25b/configure.in 2010-07-08 00:04:25.000000000 +0300
@@ -123,6 +123,8 @@
;;
esac
+AC_CHECK_LIB(rt, clock_gettime)
+
AC_ACME_TM_GMTOFF
AC_ACME_INT64T
AC_ACME_SOCKLENT
diff -Nru thttpd-2.25b.orig/thttpd.c thttpd-2.25b/thttpd.c
--- thttpd-2.25b.orig/thttpd.c 2003-12-25 21:06:52.000000000 +0200
+++ thttpd-2.25b/thttpd.c 2010-07-08 00:41:28.000000000 +0300
@@ -742,7 +742,7 @@
}
/* Main loop. */
- (void) gettimeofday( &tv, (struct timezone*) 0 );
+ tmr_prepare_timeval( &tv );
while ( ( ! terminate ) || num_connects > 0 )
{
/* Do we need to re-open the log file? */
@@ -761,7 +761,7 @@
syslog( LOG_ERR, "fdwatch - %m" );
exit( 1 );
}
- (void) gettimeofday( &tv, (struct timezone*) 0 );
+ tmr_prepare_timeval( &tv );
if ( num_ready == 0 )
{
diff -Nru thttpd-2.25b.orig/timers.c thttpd-2.25b/timers.c
--- thttpd-2.25b.orig/timers.c 2002-08-22 04:04:12.000000000 +0300
+++ thttpd-2.25b/timers.c 2010-07-08 11:47:03.000000000 +0300
@@ -41,7 +41,13 @@
ClientData JunkClientData;
-
+#undef HAVE_LIBRT_MONO
+#if defined(HAVE_LIBRT) && defined(CLOCK_MONOTONIC)
+#define HAVE_LIBRT_MONO
+#include <time.h>
+static int use_monotonic = 0; /* monotonic clock runtime availability flag */
+static struct timeval tv_diff; /* system time - monotonic difference at start */
+#endif
static unsigned int
hash( Timer* t )
@@ -145,6 +151,26 @@
timers[h] = (Timer*) 0;
free_timers = (Timer*) 0;
alloc_count = active_count = free_count = 0;
+
+ /* Check for monotonic clock availability */
+#ifdef HAVE_LIBRT_MONO
+ struct timespec ts;
+ struct timeval tv_start, tv;
+
+ /* Try to get monotonic clock time */
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ use_monotonic = 1;
+
+ /* Get current system time */
+ (void) gettimeofday( &tv_start , (struct timezone*) 0 );
+ tv.tv_sec = ts.tv_sec;
+ tv.tv_usec = ts.tv_nsec / 1000L;
+ /* Calculate and save the difference: tv_start is since the Epoch, so tv_start > ts
+ tv_diff = tv_start - tv */
+ timersub( &tv_start, &tv, &tv_diff );
+ }
+#endif
+
}
@@ -176,7 +202,7 @@
if ( nowP != (struct timeval*) 0 )
t->time = *nowP;
else
- (void) gettimeofday( &t->time, (struct timezone*) 0 );
+ tmr_prepare_timeval( &t->time );
t->time.tv_sec += msecs / 1000L;
t->time.tv_usec += ( msecs % 1000L ) * 1000L;
if ( t->time.tv_usec >= 1000000L )
@@ -349,3 +375,27 @@
if ( active_count + free_count != alloc_count )
syslog( LOG_ERR, "timer counts don't add up!" );
}
+
+/* Fill timeval structure for further usage by the package. */
+void
+tmr_prepare_timeval( struct timeval *tv )
+{
+#ifdef HAVE_LIBRT_MONO
+ struct timespec ts;
+ struct timeval tv0;
+
+ if (use_monotonic) { /* use monotonic clock source ? */
+ if (clock_gettime(CLOCK_MONOTONIC,&ts) < 0) {
+ perror("clock_gettime"); return;
+ }
+ tv0.tv_sec = ts.tv_sec;
+ tv0.tv_usec = ts.tv_nsec / 1000L;
+ /* Return system time value like it was running accurately */
+ timeradd( &tv_diff, &tv0, tv );
+ } else {
+#endif
+ (void) gettimeofday( tv , (struct timezone*) 0 );
+#ifdef HAVE_LIBRT_MONO
+ }
+#endif
+}
diff -Nru thttpd-2.25b.orig/timers.h thttpd-2.25b/timers.h
--- thttpd-2.25b.orig/timers.h 2001-04-13 08:37:41.000000000 +0300
+++ thttpd-2.25b/timers.h 2010-07-08 00:09:15.000000000 +0300
@@ -106,4 +106,7 @@
/* Generate debugging statistics syslog message. */
extern void tmr_logstats( long secs );
+/* Fill timeval structure for further usage by the package. */
+extern void tmr_prepare_timeval( struct timeval *tv );
+
#endif /* _TIMERS_H_ */
1.1 www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch?rev=1.1&content-type=text/plain
Index: thttpd-2.25b-use-Status-header.patch
===================================================================
diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c
--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:11.000000000 +0000
+++ thttpd-2.25b/libhttpd.c 2007-10-14 10:21:37.000000000 +0000
@@ -3279,7 +3279,7 @@
cp += strspn( cp, " \t" );
status = atoi( cp );
}
- if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 &&
+ else if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 &&
cp < br &&
( cp == headers || *(cp-1) == '\012' ) )
status = 302;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-28 22:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 22:25 [gentoo-commits] gentoo-x86 commit in www-servers/thttpd/files: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch thttpd-2.25b-fix-illegal-path-info.patch thttpd-2.25b-use-X-Forwarded-For-header.patch thttpd-2.25b-monolithic-timer.patch thttpd-2.25b-use-Status-header.patch Thilo Bangert (bangert)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox