]> git.pld-linux.org Git - packages/lighttpd.git/blame - lighttpd-branch.diff
- $USER does not contain anything useful for FCGI
[packages/lighttpd.git] / lighttpd-branch.diff
CommitLineData
a26d5970
ER
1Index: src/base.h
2===================================================================
3--- src/base.h (.../tags/lighttpd-1.4.13) (revision 1664)
4+++ src/base.h (.../branches/lighttpd-1.4.x) (revision 1664)
5@@ -481,7 +481,9 @@
6 enum { STAT_CACHE_ENGINE_UNSET,
7 STAT_CACHE_ENGINE_NONE,
8 STAT_CACHE_ENGINE_SIMPLE,
9+#ifdef HAVE_FAM_H
10 STAT_CACHE_ENGINE_FAM
11+#endif
12 } stat_cache_engine;
13 unsigned short enable_cores;
14 } server_config;
15Index: src/connections.c
16===================================================================
17--- src/connections.c (.../tags/lighttpd-1.4.13) (revision 1664)
18+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1664)
19@@ -970,7 +970,7 @@
20 }
21 } else {
22 /* a splited \r \n */
23- return -1;
24+ break;
25 }
26 }
27 }
28Index: src/configfile.c
29===================================================================
30--- src/configfile.c (.../tags/lighttpd-1.4.13) (revision 1664)
31+++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 1664)
32@@ -218,13 +218,19 @@
33 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
34 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("simple"))) {
35 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
36+#ifdef HAVE_FAM_H
37 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("fam"))) {
38 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_FAM;
39+#endif
40 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("disable"))) {
41 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_NONE;
42 } else {
43 log_error_write(srv, __FILE__, __LINE__, "sb",
44- "server.stat-cache-engine can be one of \"disable\", \"simple\", \"fam\", but not:", stat_cache_string);
45+ "server.stat-cache-engine can be one of \"disable\", \"simple\","
46+#ifdef HAVE_FAM_H
47+ " \"fam\","
48+#endif
49+ " but not:", stat_cache_string);
50 ret = HANDLER_ERROR;
51 }
f26f9fd5 52
a26d5970
ER
53Index: src/mod_scgi.c
54===================================================================
55--- src/mod_scgi.c (.../tags/lighttpd-1.4.13) (revision 1664)
56+++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 1664)
57@@ -2528,7 +2528,7 @@
58 hctx->reconnects < 5) {
59 scgi_reconnect(srv, hctx);
f673a614 60
a26d5970
ER
61- log_error_write(srv, __FILE__, __LINE__, "sdsdsd",
62+ log_error_write(srv, __FILE__, __LINE__, "ssdsd",
63 "response not sent, request not sent, reconnection.",
64 "connection-fd:", con->fd,
65 "fcgi-fd:", hctx->fd);
66Index: src/request.c
67===================================================================
68--- src/request.c (.../tags/lighttpd-1.4.13) (revision 1664)
69+++ src/request.c (.../branches/lighttpd-1.4.x) (revision 1664)
70@@ -85,6 +85,9 @@
71 /* Host is empty */
72 if (host_len == 0) return -1;
f26f9fd5 73
a26d5970
ER
74+ /* if the hostname ends in a "." strip it */
75+ if (host->ptr[host_len-1] == '.') host_len -= 1;
f673a614 76+
a26d5970
ER
77 /* scan from the right and skip the \0 */
78 for (i = host_len - 1; i + 1 > 0; i--) {
79 const char c = host->ptr[i];
80Index: src/network_backends.h
81===================================================================
82--- src/network_backends.h (.../tags/lighttpd-1.4.13) (revision 1664)
83+++ src/network_backends.h (.../branches/lighttpd-1.4.x) (revision 1664)
84@@ -14,7 +14,7 @@
85 # include <sys/uio.h>
86 #endif
87
88-#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && defined(__FreeBSD__)
89+#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && (defined(__FreeBSD__) || defined(__DragonFly__))
90 # define USE_FREEBSD_SENDFILE
91 # include <sys/uio.h>
92 #endif
93Index: src/mod_proxy.c
94===================================================================
95--- src/mod_proxy.c (.../tags/lighttpd-1.4.13) (revision 1664)
96+++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 1664)
97@@ -656,6 +656,7 @@
98 }
99
100 if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) {
101+ if (errno == EAGAIN) return 0;
102 log_error_write(srv, __FILE__, __LINE__, "sds",
103 "unexpected end-of-file (perhaps the proxy process died):",
104 proxy_fd, strerror(errno));
105Index: src/mod_expire.c
106===================================================================
107--- src/mod_expire.c (.../tags/lighttpd-1.4.13) (revision 1664)
108+++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 1664)
109@@ -85,7 +85,7 @@
110 /*
111 * parse
112 *
113- * '(access|modification) [plus] {<num> <type>}*'
114+ * '(access|now|modification) [plus] {<num> <type>}*'
115 *
116 * e.g. 'access 1 years'
117 */
118@@ -101,6 +101,9 @@
119 if (0 == strncmp(ts, "access ", 7)) {
120 type = 0;
121 ts += 7;
122+ } else if (0 == strncmp(ts, "now ", 4)) {
123+ type = 0;
124+ ts += 4;
125 } else if (0 == strncmp(ts, "modification ", 13)) {
126 type = 1;
127 ts += 13;
128@@ -116,7 +119,7 @@
129 ts += 5;
130 }
4eb11136 131
a26d5970
ER
132- /* the rest is just <number> (years|months|days|hours|minutes|seconds) */
133+ /* the rest is just <number> (years|months|weeks|days|hours|minutes|seconds) */
134 while (1) {
135 char *space, *err;
136 int num;
137@@ -148,6 +151,9 @@
138 } else if (slen == 6 &&
139 0 == strncmp(ts, "months", slen)) {
140 num *= 60 * 60 * 24 * 30;
141+ } else if (slen == 5 &&
142+ 0 == strncmp(ts, "weeks", slen)) {
143+ num *= 60 * 60 * 24 * 7;
144 } else if (slen == 4 &&
145 0 == strncmp(ts, "days", slen)) {
146 num *= 60 * 60 * 24;
147@@ -174,6 +180,8 @@
148 num *= 60 * 60 * 24 * 30 * 12;
149 } else if (0 == strcmp(ts, "months")) {
150 num *= 60 * 60 * 24 * 30;
151+ } else if (0 == strcmp(ts, "weeks")) {
152+ num *= 60 * 60 * 24 * 7;
153 } else if (0 == strcmp(ts, "days")) {
154 num *= 60 * 60 * 24;
155 } else if (0 == strcmp(ts, "hours")) {
156Index: src/network_freebsd_sendfile.c
157===================================================================
158--- src/network_freebsd_sendfile.c (.../tags/lighttpd-1.4.13) (revision 1664)
159+++ src/network_freebsd_sendfile.c (.../branches/lighttpd-1.4.x) (revision 1664)
160@@ -25,7 +25,7 @@
2519e6e5
ER
161
162
a26d5970
ER
163 #ifndef UIO_MAXIOV
164-# ifdef __FreeBSD__
165+# if defined(__FreeBSD__) || defined(__DragonFly__)
166 /* FreeBSD 4.7, 4.9 defined it in sys/uio.h only if _KERNEL is specified */
167 # define UIO_MAXIOV 1024
168 # endif
169Index: src/http_auth.c
170===================================================================
171--- src/http_auth.c (.../tags/lighttpd-1.4.13) (revision 1664)
172+++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 1664)
173@@ -733,8 +733,9 @@
174 }
175 }
4eb11136 176
a26d5970
ER
177+ if (p->conf.auth_ldap_allow_empty_pw != 1 && pw[0] == '\0')
178+ return -1;
2519e6e5 179
a26d5970
ER
180-
181 /* build filter */
182 buffer_copy_string_buffer(p->ldap_filter, p->conf.ldap_filter_pre);
183 buffer_append_string_buffer(p->ldap_filter, username);
184Index: src/http_auth.h
185===================================================================
186--- src/http_auth.h (.../tags/lighttpd-1.4.13) (revision 1664)
187+++ src/http_auth.h (.../branches/lighttpd-1.4.x) (revision 1664)
188@@ -36,6 +36,7 @@
189 buffer *auth_ldap_filter;
190 buffer *auth_ldap_cafile;
191 unsigned short auth_ldap_starttls;
192+ unsigned short auth_ldap_allow_empty_pw;
1175ccec 193
a26d5970 194 unsigned short auth_debug;
1175ccec 195
a26d5970
ER
196Index: src/mod_auth.c
197===================================================================
198--- src/mod_auth.c (.../tags/lighttpd-1.4.13) (revision 1664)
199+++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 1664)
200@@ -113,6 +113,7 @@
201 PATCH(auth_ldap_filter);
202 PATCH(auth_ldap_cafile);
203 PATCH(auth_ldap_starttls);
204+ PATCH(auth_ldap_allow_empty_pw);
205 #ifdef USE_LDAP
206 PATCH(ldap);
207 PATCH(ldap_filter_pre);
208@@ -160,6 +161,8 @@
209 PATCH(auth_ldap_cafile);
210 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.starttls"))) {
211 PATCH(auth_ldap_starttls);
212+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.allow-empty-pw"))) {
213+ PATCH(auth_ldap_allow_empty_pw);
214 }
215 }
216 }
217@@ -312,6 +315,7 @@
218 { "auth.backend.ldap.starttls", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
219 { "auth.backend.ldap.bind-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
220 { "auth.backend.ldap.bind-pw", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
221+ { "auth.backend.ldap.allow-empty-pw", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
222 { "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
223 { "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
224 { "auth.debug", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
225@@ -359,11 +363,12 @@
226 cv[6].destination = s->auth_ldap_filter;
227 cv[7].destination = s->auth_ldap_cafile;
228 cv[8].destination = &(s->auth_ldap_starttls);
229- cv[9].destination = s->auth_ldap_binddn;
230- cv[10].destination = s->auth_ldap_bindpw;
231- cv[11].destination = s->auth_htdigest_userfile;
232- cv[12].destination = s->auth_htpasswd_userfile;
233- cv[13].destination = &(s->auth_debug);
234+ cv[9].destination = s->auth_ldap_binddn;
235+ cv[10].destination = s->auth_ldap_bindpw;
236+ cv[11].destination = &(s->auth_ldap_allow_empty_pw);
237+ cv[12].destination = s->auth_htdigest_userfile;
238+ cv[13].destination = s->auth_htpasswd_userfile;
239+ cv[14].destination = &(s->auth_debug);
52083199 240
a26d5970
ER
241 p->config_storage[i] = s;
242 ca = ((data_config *)srv->config_context->data[i])->value;
243Index: src/mod_fastcgi.c
244===================================================================
245--- src/mod_fastcgi.c (.../tags/lighttpd-1.4.13) (revision 1664)
246+++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 1664)
247@@ -275,6 +275,7 @@
248 buffer *key; /* like .php */
4eb11136 249
a26d5970
ER
250 int note_is_sent;
251+ int last_used_ndx;
2519e6e5 252
a26d5970 253 fcgi_extension_host **hosts;
1175ccec 254
a26d5970
ER
255@@ -563,6 +564,7 @@
256 fe = calloc(1, sizeof(*fe));
257 assert(fe);
258 fe->key = buffer_init();
259+ fe->last_used_ndx = -1;
260 buffer_copy_string_buffer(fe->key, key);
1175ccec 261
a26d5970
ER
262 /* */
263@@ -2365,6 +2367,7 @@
264 * check how much we have to read
265 */
266 if (ioctl(hctx->fd, FIONREAD, &toread)) {
267+ if( errno == EAGAIN ) return 0;
268 log_error_write(srv, __FILE__, __LINE__, "sd",
269 "unexpected end-of-file (perhaps the fastcgi process died):",
270 fcgi_fd);
271@@ -2375,12 +2378,23 @@
2519e6e5 272
a26d5970
ER
273 if (toread > 0) {
274 buffer *b;
275+ chunk *cq_first = hctx->rb->first;
276+ chunk *cq_last = hctx->rb->last;
277
278 b = chunkqueue_get_append_buffer(hctx->rb);
279 buffer_prepare_copy(b, toread + 1);
280
281 /* append to read-buffer */
282 if (-1 == (r = read(hctx->fd, b->ptr, toread))) {
283+ if( errno == EAGAIN ) {
284+ /* roll back the last chunk allocation,
285+ and continue on next iteration */
286+ buffer_free(hctx->rb->last->mem);
287+ free(hctx->rb->last);
288+ hctx->rb->first = cq_first;
289+ hctx->rb->last = cq_last;
290+ return 0;
291+ }
292 log_error_write(srv, __FILE__, __LINE__, "sds",
293 "unexpected end-of-file (perhaps the fastcgi process died):",
294 fcgi_fd, strerror(errno));
295@@ -2393,6 +2407,7 @@
296 b->used = r + 1; /* one extra for the fake \0 */
297 b->ptr[b->used - 1] = '\0';
298 } else {
299+ if( errno == EAGAIN ) return 0;
300 log_error_write(srv, __FILE__, __LINE__, "ssdsb",
301 "unexpected end-of-file (perhaps the fastcgi process died):",
302 "pid:", proc->pid,
303@@ -2499,6 +2514,8 @@
304 }
305 break;
306 case FCGI_STDERR:
307+ if (packet.len == 0) break;
2519e6e5 308+
a26d5970
ER
309 log_error_write(srv, __FILE__, __LINE__, "sb",
310 "FastCGI-stderr:", packet.b);
2519e6e5 311
a26d5970
ER
312@@ -2979,17 +2996,23 @@
313 size_t k;
314 int ndx, used = -1;
315
316- /* get best server */
317- for (k = 0, ndx = -1; k < hctx->ext->used; k++) {
318- host = hctx->ext->hosts[k];
319+ /* check if the next server has no load. */
320+ ndx = hctx->ext->last_used_ndx + 1;
321+ if(ndx >= hctx->ext->used || ndx < 0) ndx = 0;
322+ host = hctx->ext->hosts[ndx];
323+ if (host->load > 0) {
324+ /* get backend with the least load. */
325+ for (k = 0, ndx = -1; k < hctx->ext->used; k++) {
326+ host = hctx->ext->hosts[k];
327
328- /* we should have at least one proc that can do something */
329- if (host->active_procs == 0) continue;
330+ /* we should have at least one proc that can do something */
331+ if (host->active_procs == 0) continue;
332
333- if (used == -1 || host->load < used) {
334- used = host->load;
335+ if (used == -1 || host->load < used) {
336+ used = host->load;
2519e6e5 337
a26d5970
ER
338- ndx = k;
339+ ndx = k;
340+ }
341 }
2519e6e5 342 }
2519e6e5 343
a26d5970
ER
344@@ -3005,6 +3028,7 @@
345 return HANDLER_FINISHED;
2519e6e5 346 }
2519e6e5 347
a26d5970
ER
348+ hctx->ext->last_used_ndx = ndx;
349 host = hctx->ext->hosts[ndx];
2519e6e5 350
a26d5970
ER
351 /*
352Index: src/server.c
353===================================================================
354--- src/server.c (.../tags/lighttpd-1.4.13) (revision 1664)
355+++ src/server.c (.../branches/lighttpd-1.4.x) (revision 1664)
356@@ -163,6 +163,7 @@
357 #undef CLEAN
2519e6e5 358
a26d5970
ER
359 for (i = 0; i < FILE_CACHE_MAX; i++) {
360+ srv->mtime_cache[i].mtime = (time_t)-1;
361 srv->mtime_cache[i].str = buffer_init();
2519e6e5 362 }
2519e6e5 363
a26d5970
ER
364@@ -1231,6 +1232,19 @@
365 srv_socket->fd = -1;
2519e6e5 366
a26d5970 367 /* network_close() will cleanup after us */
2519e6e5 368+
a26d5970
ER
369+ if (srv->srvconf.pid_file->used &&
370+ srv->srvconf.changeroot->used == 0) {
371+ if (0 != unlink(srv->srvconf.pid_file->ptr)) {
372+ if (errno != EACCES && errno != EPERM) {
373+ log_error_write(srv, __FILE__, __LINE__, "sbds",
374+ "unlink failed for:",
375+ srv->srvconf.pid_file,
376+ errno,
377+ strerror(errno));
378+ }
379+ }
380+ }
381 }
382 }
2519e6e5 383
a26d5970
ER
384@@ -1335,7 +1349,8 @@
385 }
2519e6e5 386
a26d5970
ER
387 if (srv->srvconf.pid_file->used &&
388- srv->srvconf.changeroot->used == 0) {
389+ srv->srvconf.changeroot->used == 0 &&
390+ 0 == graceful_shutdown) {
391 if (0 != unlink(srv->srvconf.pid_file->ptr)) {
392 if (errno != EACCES && errno != EPERM) {
393 log_error_write(srv, __FILE__, __LINE__, "sbds",
394
395Property changes on: .
396___________________________________________________________________
397Name: svk:merge
398 + a98e19e4-a712-0410-8832-6551a15ffc53:/local/branches/lighttpd-1.4.x:1557
399
This page took 0.7086 seconds and 4 git commands to generate.