1 |
bangert 10/10/28 22:25:24 |
2 |
|
3 |
Added: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch |
4 |
thttpd-2.25b-fix-illegal-path-info.patch |
5 |
thttpd-2.25b-use-X-Forwarded-For-header.patch |
6 |
thttpd-2.25b-monolithic-timer.patch |
7 |
thttpd-2.25b-use-Status-header.patch |
8 |
Log: |
9 |
Bump. EAPI=3, dont freeze when time goes backwards (#327615), dont link |
10 |
statically by default (#273319), respect CFLAGS (#241464), fix illegal |
11 |
PATH_INFO, use Status on all Location headers, use IP from |
12 |
X-Forwarded-For (all #331747). |
13 |
|
14 |
(Portage version: 2.2_rc99/cvs/Linux i686) |
15 |
|
16 |
Revision Changes Path |
17 |
1.1 www-servers/thttpd/files/thttpd-2.25b-respect-CFLAGS--dont-link-static.patch |
18 |
|
19 |
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 |
20 |
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 |
21 |
|
22 |
Index: thttpd-2.25b-respect-CFLAGS--dont-link-static.patch |
23 |
=================================================================== |
24 |
diff -Naur thttpd-2.25b.orig/cgi-src/Makefile.in thttpd-2.25b/cgi-src/Makefile.in |
25 |
--- thttpd-2.25b.orig/cgi-src/Makefile.in 2010-10-28 23:33:28.000000000 +0200 |
26 |
+++ thttpd-2.25b/cgi-src/Makefile.in 2010-10-29 00:05:43.000000000 +0200 |
27 |
@@ -31,10 +31,9 @@ |
28 |
MANDIR = @mandir@ |
29 |
|
30 |
CC = @CC@ |
31 |
-CCOPT = @V_CCOPT@ |
32 |
DEFS = @DEFS@ |
33 |
INCLS = -I.. |
34 |
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS) |
35 |
+CFLAGS += $(DEFS) $(INCLS) |
36 |
LDFLAGS = @LDFLAGS@ @V_STATICFLAG@ |
37 |
LIBS = @LIBS@ |
38 |
NETLIBS = @V_NETLIBS@ |
39 |
diff -Naur thttpd-2.25b.orig/extras/Makefile.in thttpd-2.25b/extras/Makefile.in |
40 |
--- thttpd-2.25b.orig/extras/Makefile.in 2010-10-28 23:33:28.000000000 +0200 |
41 |
+++ thttpd-2.25b/extras/Makefile.in 2010-10-29 00:06:36.000000000 +0200 |
42 |
@@ -32,11 +32,9 @@ |
43 |
MANDIR = @mandir@ |
44 |
|
45 |
CC = @CC@ |
46 |
-CCOPT = @V_CCOPT@ |
47 |
DEFS = @DEFS@ |
48 |
INCLS = -I.. |
49 |
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS) |
50 |
-STATICFLAG = @V_STATICFLAG@ |
51 |
+CFLAGS += $(DEFS) $(INCLS) |
52 |
LDFLAGS = @LDFLAGS@ |
53 |
LIBS = @LIBS@ |
54 |
NETLIBS = @V_NETLIBS@ |
55 |
@@ -59,7 +57,7 @@ |
56 |
$(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c makeweb.c |
57 |
|
58 |
htpasswd: htpasswd.o |
59 |
- $(CC) $(LDFLAGS) $(STATICFLAG) htpasswd.o -o htpasswd $(LIBS) |
60 |
+ $(CC) $(LDFLAGS) htpasswd.o -o htpasswd $(LIBS) |
61 |
|
62 |
htpasswd.o: htpasswd.c ../config.h |
63 |
$(CC) $(CFLAGS) -DWEBDIR=\"$(WEBDIR)\" -c htpasswd.c |
64 |
diff -Naur thttpd-2.25b.orig/Makefile.in thttpd-2.25b/Makefile.in |
65 |
--- thttpd-2.25b.orig/Makefile.in 2010-10-28 23:33:28.000000000 +0200 |
66 |
+++ thttpd-2.25b/Makefile.in 2010-10-29 00:05:43.000000000 +0200 |
67 |
@@ -47,10 +47,9 @@ |
68 |
# You shouldn't need to edit anything below here. |
69 |
|
70 |
CC = @CC@ |
71 |
-CCOPT = @V_CCOPT@ |
72 |
DEFS = @DEFS@ |
73 |
INCLS = -I. |
74 |
-CFLAGS = $(CCOPT) $(DEFS) $(INCLS) |
75 |
+CFLAGS += $(DEFS) $(INCLS) |
76 |
LDFLAGS = @LDFLAGS@ |
77 |
LIBS = @LIBS@ |
78 |
NETLIBS = @V_NETLIBS@ |
79 |
|
80 |
|
81 |
|
82 |
1.1 www-servers/thttpd/files/thttpd-2.25b-fix-illegal-path-info.patch |
83 |
|
84 |
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 |
85 |
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 |
86 |
|
87 |
Index: thttpd-2.25b-fix-illegal-path-info.patch |
88 |
=================================================================== |
89 |
diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c |
90 |
--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:55.000000000 +0000 |
91 |
+++ thttpd-2.25b/libhttpd.c 2007-10-14 10:09:11.000000000 +0000 |
92 |
@@ -2322,8 +2320,11 @@ |
93 |
{ |
94 |
int i; |
95 |
i = strlen( hc->origfilename ) - strlen( hc->pathinfo ); |
96 |
- if ( i > 0 && strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 ) |
97 |
- hc->origfilename[i - 1] = '\0'; |
98 |
+ if ( strcmp( &hc->origfilename[i], hc->pathinfo ) == 0 ) |
99 |
+ { |
100 |
+ if ( i == 0 ) hc->origfilename[0] = '\0'; |
101 |
+ else hc->origfilename[i - 1] = '\0'; |
102 |
+ } |
103 |
} |
104 |
|
105 |
/* If the expanded filename is an absolute path, check that it's still |
106 |
|
107 |
|
108 |
|
109 |
1.1 www-servers/thttpd/files/thttpd-2.25b-use-X-Forwarded-For-header.patch |
110 |
|
111 |
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 |
112 |
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 |
113 |
|
114 |
Index: thttpd-2.25b-use-X-Forwarded-For-header.patch |
115 |
=================================================================== |
116 |
--- thttpd-2.25b/libhttpd.c 2003-12-25 20:06:05.000000000 +0100 |
117 |
+++ thttpd-2.25b-patched/libhttpd.c 2005-01-09 00:26:04.867255248 +0100 |
118 |
@@ -2207,6 +2207,12 @@ |
119 |
if ( strcasecmp( cp, "keep-alive" ) == 0 ) |
120 |
hc->keep_alive = 1; |
121 |
} |
122 |
+ else if ( strncasecmp( buf, "X-Forwarded-For:", 16 ) == 0 ) |
123 |
+ { // Use real IP if available |
124 |
+ cp = &buf[16]; |
125 |
+ cp += strspn( cp, " \t" ); |
126 |
+ inet_aton( cp, &(hc->client_addr.sa_in.sin_addr) ); |
127 |
+ } |
128 |
#ifdef LOG_UNKNOWN_HEADERS |
129 |
else if ( strncasecmp( buf, "Accept-Charset:", 15 ) == 0 || |
130 |
strncasecmp( buf, "Accept-Language:", 16 ) == 0 || |
131 |
|
132 |
|
133 |
|
134 |
1.1 www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch |
135 |
|
136 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/thttpd/files/thttpd-2.25b-monolithic-timer.patch?rev=1.1&view=markup |
137 |
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 |
138 |
|
139 |
Index: thttpd-2.25b-monolithic-timer.patch |
140 |
=================================================================== |
141 |
diff -Nru thttpd-2.25b.orig/configure.in thttpd-2.25b/configure.in |
142 |
--- thttpd-2.25b.orig/configure.in 2003-12-25 20:41:13.000000000 +0200 |
143 |
+++ thttpd-2.25b/configure.in 2010-07-08 00:04:25.000000000 +0300 |
144 |
@@ -123,6 +123,8 @@ |
145 |
;; |
146 |
esac |
147 |
|
148 |
+AC_CHECK_LIB(rt, clock_gettime) |
149 |
+ |
150 |
AC_ACME_TM_GMTOFF |
151 |
AC_ACME_INT64T |
152 |
AC_ACME_SOCKLENT |
153 |
diff -Nru thttpd-2.25b.orig/thttpd.c thttpd-2.25b/thttpd.c |
154 |
--- thttpd-2.25b.orig/thttpd.c 2003-12-25 21:06:52.000000000 +0200 |
155 |
+++ thttpd-2.25b/thttpd.c 2010-07-08 00:41:28.000000000 +0300 |
156 |
@@ -742,7 +742,7 @@ |
157 |
} |
158 |
|
159 |
/* Main loop. */ |
160 |
- (void) gettimeofday( &tv, (struct timezone*) 0 ); |
161 |
+ tmr_prepare_timeval( &tv ); |
162 |
while ( ( ! terminate ) || num_connects > 0 ) |
163 |
{ |
164 |
/* Do we need to re-open the log file? */ |
165 |
@@ -761,7 +761,7 @@ |
166 |
syslog( LOG_ERR, "fdwatch - %m" ); |
167 |
exit( 1 ); |
168 |
} |
169 |
- (void) gettimeofday( &tv, (struct timezone*) 0 ); |
170 |
+ tmr_prepare_timeval( &tv ); |
171 |
|
172 |
if ( num_ready == 0 ) |
173 |
{ |
174 |
diff -Nru thttpd-2.25b.orig/timers.c thttpd-2.25b/timers.c |
175 |
--- thttpd-2.25b.orig/timers.c 2002-08-22 04:04:12.000000000 +0300 |
176 |
+++ thttpd-2.25b/timers.c 2010-07-08 11:47:03.000000000 +0300 |
177 |
@@ -41,7 +41,13 @@ |
178 |
|
179 |
ClientData JunkClientData; |
180 |
|
181 |
- |
182 |
+#undef HAVE_LIBRT_MONO |
183 |
+#if defined(HAVE_LIBRT) && defined(CLOCK_MONOTONIC) |
184 |
+#define HAVE_LIBRT_MONO |
185 |
+#include <time.h> |
186 |
+static int use_monotonic = 0; /* monotonic clock runtime availability flag */ |
187 |
+static struct timeval tv_diff; /* system time - monotonic difference at start */ |
188 |
+#endif |
189 |
|
190 |
static unsigned int |
191 |
hash( Timer* t ) |
192 |
@@ -145,6 +151,26 @@ |
193 |
timers[h] = (Timer*) 0; |
194 |
free_timers = (Timer*) 0; |
195 |
alloc_count = active_count = free_count = 0; |
196 |
+ |
197 |
+ /* Check for monotonic clock availability */ |
198 |
+#ifdef HAVE_LIBRT_MONO |
199 |
+ struct timespec ts; |
200 |
+ struct timeval tv_start, tv; |
201 |
+ |
202 |
+ /* Try to get monotonic clock time */ |
203 |
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { |
204 |
+ use_monotonic = 1; |
205 |
+ |
206 |
+ /* Get current system time */ |
207 |
+ (void) gettimeofday( &tv_start , (struct timezone*) 0 ); |
208 |
+ tv.tv_sec = ts.tv_sec; |
209 |
+ tv.tv_usec = ts.tv_nsec / 1000L; |
210 |
+ /* Calculate and save the difference: tv_start is since the Epoch, so tv_start > ts |
211 |
+ tv_diff = tv_start - tv */ |
212 |
+ timersub( &tv_start, &tv, &tv_diff ); |
213 |
+ } |
214 |
+#endif |
215 |
+ |
216 |
} |
217 |
|
218 |
|
219 |
@@ -176,7 +202,7 @@ |
220 |
if ( nowP != (struct timeval*) 0 ) |
221 |
t->time = *nowP; |
222 |
else |
223 |
- (void) gettimeofday( &t->time, (struct timezone*) 0 ); |
224 |
+ tmr_prepare_timeval( &t->time ); |
225 |
t->time.tv_sec += msecs / 1000L; |
226 |
t->time.tv_usec += ( msecs % 1000L ) * 1000L; |
227 |
if ( t->time.tv_usec >= 1000000L ) |
228 |
@@ -349,3 +375,27 @@ |
229 |
if ( active_count + free_count != alloc_count ) |
230 |
syslog( LOG_ERR, "timer counts don't add up!" ); |
231 |
} |
232 |
+ |
233 |
+/* Fill timeval structure for further usage by the package. */ |
234 |
+void |
235 |
+tmr_prepare_timeval( struct timeval *tv ) |
236 |
+{ |
237 |
+#ifdef HAVE_LIBRT_MONO |
238 |
+ struct timespec ts; |
239 |
+ struct timeval tv0; |
240 |
+ |
241 |
+ if (use_monotonic) { /* use monotonic clock source ? */ |
242 |
+ if (clock_gettime(CLOCK_MONOTONIC,&ts) < 0) { |
243 |
+ perror("clock_gettime"); return; |
244 |
+ } |
245 |
+ tv0.tv_sec = ts.tv_sec; |
246 |
+ tv0.tv_usec = ts.tv_nsec / 1000L; |
247 |
+ /* Return system time value like it was running accurately */ |
248 |
+ timeradd( &tv_diff, &tv0, tv ); |
249 |
+ } else { |
250 |
+#endif |
251 |
+ (void) gettimeofday( tv , (struct timezone*) 0 ); |
252 |
+#ifdef HAVE_LIBRT_MONO |
253 |
+ } |
254 |
+#endif |
255 |
+} |
256 |
diff -Nru thttpd-2.25b.orig/timers.h thttpd-2.25b/timers.h |
257 |
--- thttpd-2.25b.orig/timers.h 2001-04-13 08:37:41.000000000 +0300 |
258 |
+++ thttpd-2.25b/timers.h 2010-07-08 00:09:15.000000000 +0300 |
259 |
@@ -106,4 +106,7 @@ |
260 |
/* Generate debugging statistics syslog message. */ |
261 |
extern void tmr_logstats( long secs ); |
262 |
|
263 |
+/* Fill timeval structure for further usage by the package. */ |
264 |
+extern void tmr_prepare_timeval( struct timeval *tv ); |
265 |
+ |
266 |
#endif /* _TIMERS_H_ */ |
267 |
|
268 |
|
269 |
|
270 |
1.1 www-servers/thttpd/files/thttpd-2.25b-use-Status-header.patch |
271 |
|
272 |
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 |
273 |
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 |
274 |
|
275 |
Index: thttpd-2.25b-use-Status-header.patch |
276 |
=================================================================== |
277 |
diff -Naur thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c |
278 |
--- thttpd-2.25b.orig/libhttpd.c 2007-10-14 10:09:11.000000000 +0000 |
279 |
+++ thttpd-2.25b/libhttpd.c 2007-10-14 10:21:37.000000000 +0000 |
280 |
@@ -3279,7 +3279,7 @@ |
281 |
cp += strspn( cp, " \t" ); |
282 |
status = atoi( cp ); |
283 |
} |
284 |
- if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 && |
285 |
+ else if ( ( cp = strstr( headers, "Location:" ) ) != (char*) 0 && |
286 |
cp < br && |
287 |
( cp == headers || *(cp-1) == '\012' ) ) |
288 |
status = 302; |