]> git.pld-linux.org Git - packages/lighttpd.git/blame - lighttpd-branch.diff
- up to 2613:
[packages/lighttpd.git] / lighttpd-branch.diff
CommitLineData
ceb30c4b
ER
1Index: ChangeLog
2===================================================================
3Index: .cvsignore
4===================================================================
5Index: src/.cvsignore
6===================================================================
7Index: src/configfile-glue.c
8===================================================================
9--- src/configfile-glue.c (.../tags/lighttpd-1.4.23) (revision 2613)
10+++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2613)
11@@ -103,7 +103,6 @@
12 if (e != ds->value->ptr && !*e && l >=0 && l <= 65535) {
13 *((unsigned short *)(cv[i].destination)) = l;
14 break;
15-
16 }
17 }
18
19@@ -112,10 +111,40 @@
20 return -1;
21 }
22 default:
23- log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected a integer, range 0 ... 65535");
24+ log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected a short integer, range 0 ... 65535");
25 return -1;
26 }
27 break;
28+ case T_CONFIG_INT:
29+ switch(du->type) {
30+ case TYPE_INTEGER: {
31+ data_integer *di = (data_integer *)du;
32+
33+ *((unsigned int *)(cv[i].destination)) = di->value;
34+ break;
35+ }
36+ case TYPE_STRING: {
37+ data_string *ds = (data_string *)du;
38+
39+ if (ds->value->ptr && *ds->value->ptr) {
40+ char *e;
41+ long l = strtol(ds->value->ptr, &e, 10);
42+ if (e != ds->value->ptr && !*e && l >= 0) {
43+ *((unsigned int *)(cv[i].destination)) = l;
44+ break;
45+ }
46+ }
47+
48+
49+ log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected an integer:", cv[i].key, ds->value);
50+
51+ return -1;
52+ }
53+ default:
54+ log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected an integer, range 0 ... 4294967295");
55+ return -1;
56+ }
57+ break;
58 case T_CONFIG_BOOLEAN:
59 if (du->type == TYPE_STRING) {
60 data_string *ds = (data_string *)du;
61Index: src/mod_cgi.c
62===================================================================
63--- src/mod_cgi.c (.../tags/lighttpd-1.4.23) (revision 2613)
64+++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2613)
65@@ -56,6 +56,7 @@
66
67 typedef struct {
68 array *cgi;
69+ unsigned short execute_x_only;
70 } plugin_config;
71
72 typedef struct {
73@@ -151,6 +152,7 @@
74
75 config_values_t cv[] = {
76 { "cgi.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
77+ { "cgi.execute-x-only", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
78 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET}
79 };
80
81@@ -165,8 +167,10 @@
82 assert(s);
83
84 s->cgi = array_init();
85+ s->execute_x_only = 0;
86
87 cv[0].destination = s->cgi;
88+ cv[1].destination = &(s->execute_x_only);
89
90 p->config_storage[i] = s;
91
92@@ -580,12 +584,9 @@
93 #if 0
94 log_error_write(srv, __FILE__, __LINE__, "sd", "(debug) cgi exited fine, pid:", pid);
95 #endif
96- pid = 0;
97-
98 return HANDLER_GO_ON;
99 } else {
100 log_error_write(srv, __FILE__, __LINE__, "sd", "cgi died, pid:", pid);
101- pid = 0;
102 return HANDLER_GO_ON;
103 }
104 }
105@@ -1005,7 +1006,7 @@
106 args[i++] = cgi_handler->ptr;
107 }
108 args[i++] = con->physical.path->ptr;
109- args[i++] = NULL;
110+ args[i ] = NULL;
111
112 /* search for the last / */
113 if (NULL != (c = strrchr(con->physical.path->ptr, '/'))) {
114@@ -1018,8 +1019,6 @@
115 *c = '/';
116 }
117
118- openDevNull(STDERR_FILENO);
119-
120 /* we don't need the client socket */
121 for (i = 3; i < 256; i++) {
122 if (i != srv->errorlog_fd) close(i);
123@@ -1198,6 +1197,8 @@
124
125 if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.assign"))) {
126 PATCH(cgi);
127+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.execute-x-only"))) {
128+ PATCH(execute_x_only);
129 }
130 }
131 }
132@@ -1220,6 +1221,7 @@
133
134 if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) return HANDLER_GO_ON;
135 if (!S_ISREG(sce->st.st_mode)) return HANDLER_GO_ON;
136+ if (p->conf.execute_x_only == 1 && (sce->st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) return HANDLER_GO_ON;
137
138 s_len = fn->used - 1;
139
140Index: src/network_write.c
141===================================================================
142--- src/network_write.c (.../tags/lighttpd-1.4.23) (revision 2613)
143+++ src/network_write.c (.../branches/lighttpd-1.4.x) (revision 2613)
144@@ -46,15 +46,27 @@
145 toSend = c->mem->used - 1 - c->offset;
146 #ifdef __WIN32
147 if ((r = send(fd, offset, toSend, 0)) < 0) {
148- log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed: ", strerror(errno), fd);
149+ /* no error handling for windows... */
150+ log_error_write(srv, __FILE__, __LINE__, "ssd", "send failed: ", strerror(errno), fd);
151
152 return -1;
153 }
154 #else
155 if ((r = write(fd, offset, toSend)) < 0) {
156- log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed: ", strerror(errno), fd);
157+ switch (errno) {
158+ case EAGAIN:
159+ case EINTR:
160+ r = 0;
161+ break;
162+ case EPIPE:
163+ case ECONNRESET:
164+ return -2;
165+ default:
166+ log_error_write(srv, __FILE__, __LINE__, "ssd",
167+ "write failed:", strerror(errno), fd);
168
169- return -1;
170+ return -1;
171+ }
172 }
173 #endif
174
175@@ -98,7 +110,7 @@
176 return -1;
177 }
178
179-#if defined USE_MMAP
180+#ifdef USE_MMAP
181 if (MAP_FAILED == (p = mmap(0, sce->st.st_size, PROT_READ, MAP_SHARED, ifd, 0))) {
182 log_error_write(srv, __FILE__, __LINE__, "ss", "mmap failed: ", strerror(errno));
183
184@@ -109,13 +121,26 @@
185 close(ifd);
186
187 if ((r = write(fd, p + offset, toSend)) <= 0) {
188- log_error_write(srv, __FILE__, __LINE__, "ss", "write failed: ", strerror(errno));
189- munmap(p, sce->st.st_size);
190- return -1;
191+ switch (errno) {
192+ case EAGAIN:
193+ case EINTR:
194+ r = 0;
195+ break;
196+ case EPIPE:
197+ case ECONNRESET:
198+ munmap(p, sce->st.st_size);
199+ return -2;
200+ default:
201+ log_error_write(srv, __FILE__, __LINE__, "ssd",
202+ "write failed:", strerror(errno), fd);
203+ munmap(p, sce->st.st_size);
204+
205+ return -1;
206+ }
207 }
208
209 munmap(p, sce->st.st_size);
210-#else
211+#else /* USE_MMAP */
212 buffer_prepare_copy(srv->tmp_buf, toSend);
213
214 lseek(ifd, offset, SEEK_SET);
215@@ -127,12 +152,33 @@
216 }
217 close(ifd);
218
219- if (-1 == (r = send(fd, srv->tmp_buf->ptr, toSend, 0))) {
220- log_error_write(srv, __FILE__, __LINE__, "ss", "write: ", strerror(errno));
221+#ifdef __WIN32
222+ if ((r = send(fd, srv->tmp_buf->ptr, toSend, 0)) < 0) {
223+ /* no error handling for windows... */
224+ log_error_write(srv, __FILE__, __LINE__, "ssd", "send failed: ", strerror(errno), fd);
225
226 return -1;
227 }
228-#endif
229+#else /* __WIN32 */
230+ if ((r = write(fd, srv->tmp_buf->ptr, toSend)) < 0) {
231+ switch (errno) {
232+ case EAGAIN:
233+ case EINTR:
234+ r = 0;
235+ break;
236+ case EPIPE:
237+ case ECONNRESET:
238+ return -2;
239+ default:
240+ log_error_write(srv, __FILE__, __LINE__, "ssd",
241+ "write failed:", strerror(errno), fd);
242+
243+ return -1;
244+ }
245+ }
246+#endif /* __WIN32 */
247+#endif /* USE_MMAP */
248+
249 c->offset += r;
250 cq->bytes_out += r;
251
252Index: src/mod_secure_download.c
253===================================================================
254--- src/mod_secure_download.c (.../tags/lighttpd-1.4.23) (revision 2613)
255+++ src/mod_secure_download.c (.../branches/lighttpd-1.4.x) (revision 2613)
256@@ -37,7 +37,7 @@
257 buffer *secret;
258 buffer *uri_prefix;
259
260- unsigned short timeout;
261+ unsigned int timeout;
262 } plugin_config;
263
264 typedef struct {
265@@ -99,7 +99,7 @@
266 { "secdownload.secret", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
267 { "secdownload.document-root", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
268 { "secdownload.uri-prefix", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
269- { "secdownload.timeout", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
270+ { "secdownload.timeout", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
271 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
272 };
273
274@@ -245,8 +245,8 @@
275 }
276
277 /* timed-out */
278- if ( (srv->cur_ts > ts && srv->cur_ts - ts > p->conf.timeout) ||
279- (srv->cur_ts < ts && ts - srv->cur_ts > p->conf.timeout) ) {
280+ if ( (srv->cur_ts > ts && (unsigned int) (srv->cur_ts - ts) > p->conf.timeout) ||
281+ (srv->cur_ts < ts && (unsigned int) (ts - srv->cur_ts) > p->conf.timeout) ) {
282 /* "Gone" as the url will never be valid again instead of "408 - Timeout" where the request may be repeated */
283 con->http_status = 410;
284
285Index: src/base.h
286===================================================================
287--- src/base.h (.../tags/lighttpd-1.4.23) (revision 2613)
288+++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2613)
289@@ -84,6 +84,7 @@
290 typedef enum { T_CONFIG_UNSET,
291 T_CONFIG_STRING,
292 T_CONFIG_SHORT,
293+ T_CONFIG_INT,
294 T_CONFIG_BOOLEAN,
295 T_CONFIG_ARRAY,
296 T_CONFIG_LOCAL,
297@@ -281,7 +282,7 @@
298 unsigned short etag_use_mtime;
299 unsigned short etag_use_size;
300 unsigned short force_lowercase_filenames; /* if the FS is case-insensitive, force all files to lower-case */
301- unsigned short max_request_size;
302+ unsigned int max_request_size;
303
304 unsigned short kbytes_per_second; /* connection kb/s limit */
305
306@@ -472,6 +473,7 @@
307
308 buffer *errorlog_file;
309 unsigned short errorlog_use_syslog;
310+ buffer *breakagelog_file;
311
312 unsigned short dont_daemonize;
313 buffer *changeroot;
314@@ -490,7 +492,7 @@
315 unsigned short max_worker;
316 unsigned short max_fds;
317 unsigned short max_conns;
318- unsigned short max_request_size;
319+ unsigned int max_request_size;
320
321 unsigned short log_request_header_on_error;
322 unsigned short log_state_handling;
323@@ -538,7 +540,7 @@
324
325 /* the errorlog */
326 int errorlog_fd;
327- enum { ERRORLOG_STDERR, ERRORLOG_FILE, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode;
328+ enum { ERRORLOG_FILE, ERRORLOG_FD, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode;
329 buffer *errorlog_buf;
330
331 fdevents *ev, *ev_ins;
332Index: src/mod_rewrite.c
333===================================================================
334--- src/mod_rewrite.c (.../tags/lighttpd-1.4.23) (revision 2613)
335+++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2613)
336@@ -176,7 +176,7 @@
337 data_unset *du;
338
339 if (NULL != (du = array_get_element(ca, option))) {
340- data_array *da = (data_array *)du;
341+ data_array *da;
342 size_t j;
343
344 if (du->type != TYPE_ARRAY) {
345@@ -373,7 +373,7 @@
346 }
347 } else {
348 const char **list;
349- size_t start, end;
350+ size_t start;
351 size_t k;
352
353 /* it matched */
354@@ -383,17 +383,15 @@
355
356 buffer_reset(con->request.uri);
357
358- start = 0; end = pattern_len;
359+ start = 0;
360 for (k = 0; k < pattern_len; k++) {
361 if (pattern[k] == '$' || pattern[k] == '%') {
362 /* got one */
363
364 size_t num = pattern[k + 1] - '0';
365
366- end = k;
367+ buffer_append_string_len(con->request.uri, pattern + start, k - start);
368
369- buffer_append_string_len(con->request.uri, pattern + start, end - start);
370-
371 if (!isdigit((unsigned char)pattern[k + 1])) {
372 /* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
373 buffer_append_string_len(con->request.uri, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
374Index: src/connections.c
375===================================================================
376--- src/connections.c (.../tags/lighttpd-1.4.23) (revision 2613)
377+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2613)
378@@ -782,13 +782,13 @@
379 CLEAN(request.pathinfo);
380 CLEAN(request.request);
381
382- CLEAN(request.orig_uri);
383+ /* CLEAN(request.orig_uri); */
384
385 CLEAN(uri.scheme);
386- CLEAN(uri.authority);
387- CLEAN(uri.path);
388+ /* CLEAN(uri.authority); */
389+ /* CLEAN(uri.path); */
390 CLEAN(uri.path_raw);
391- CLEAN(uri.query);
392+ /* CLEAN(uri.query); */
393
394 CLEAN(physical.doc_root);
395 CLEAN(physical.path);
396@@ -1401,6 +1401,11 @@
397 "state for fd", con->fd, connection_get_state(con->state));
398 }
399
400+ buffer_reset(con->uri.authority);
401+ buffer_reset(con->uri.path);
402+ buffer_reset(con->uri.query);
403+ buffer_reset(con->request.orig_uri);
404+
405 if (http_request_parse(srv, con)) {
406 /* we have to read some data from the POST request */
407
408@@ -1725,7 +1730,7 @@
409 case HANDLER_FINISHED:
410 break;
411 default:
412- log_error_write(srv, __FILE__, __LINE__, "");
413+ log_error_write(srv, __FILE__, __LINE__, "sd", "unhandling return value", r);
414 break;
415 }
416 break;
417Index: src/network.c
418===================================================================
419--- src/network.c (.../tags/lighttpd-1.4.23) (revision 2613)
420+++ src/network.c (.../branches/lighttpd-1.4.x) (revision 2613)
421@@ -167,6 +167,11 @@
422 }
423 }
424
425+#ifdef FD_CLOEXEC
426+ /* set FD_CLOEXEC now, fdevent_fcntl_set is called later; needed for pipe-logger forks */
427+ fcntl(srv_socket->fd, F_SETFD, FD_CLOEXEC);
428+#endif
429+
430 /* */
431 srv->cur_fds = srv_socket->fd;
432
433@@ -280,8 +285,6 @@
434
435 break;
436 default:
437- addr_len = 0;
438-
439 return -1;
440 }
441
442@@ -567,12 +570,8 @@
443 /* not our stage */
444 if (COMP_SERVER_SOCKET != dc->comp) continue;
445
446- if (dc->cond != CONFIG_COND_EQ) {
447- log_error_write(srv, __FILE__, __LINE__, "s", "only == is allowed for $SERVER[\"socket\"].");
448+ if (dc->cond != CONFIG_COND_EQ) continue;
449
450- return -1;
451- }
452-
453 /* check if we already know this socket,
454 * if yes, don't init it */
455 for (j = 0; j < srv->srv_sockets.used; j++) {
456Index: src/configfile.c
457===================================================================
458--- src/configfile.c (.../tags/lighttpd-1.4.23) (revision 2613)
459+++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 2613)
460@@ -42,12 +42,12 @@
461
462 { "server.event-handler", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 10 */
463 { "server.pid-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 11 */
464- { "server.max-request-size", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
465+ { "server.max-request-size", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
466 { "server.max-worker", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 13 */
467 { "server.document-root", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
468- { "server.force-lowercase-filenames", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 15 */
469+ { "server.force-lowercase-filenames", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },/* 15 */
470 { "debug.log-condition-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 16 */
471- { "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */
472+ { "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },/* 17 */
473 { "server.name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 18 */
474 { "server.max-keep-alive-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 19 */
475
476@@ -91,12 +91,13 @@
477 { "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 46 */
478 { "ssl.cipher-list", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 47 */
479 { "ssl.use-sslv2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 48 */
480- { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
481- { "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
482- { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
483+ { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
484+ { "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
485+ { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
486 { "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */
487 { "debug.log-timeouts", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 53 */
488- { "server.defer-accept", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 54 */
489+ { "server.defer-accept", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 54 */
490+ { "server.breakagelog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 55 */
491 { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
492 { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
493 { "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
494@@ -139,6 +140,8 @@
495 cv[43].destination = &(srv->srvconf.max_conns);
496 cv[12].destination = &(srv->srvconf.max_request_size);
497 cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
498+ cv[55].destination = srv->srvconf.breakagelog_file;
499+
500 srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
501
502 assert(srv->config_storage);
503@@ -290,6 +293,7 @@
504 PATCH(log_condition_handling);
505 PATCH(log_file_not_found);
506 PATCH(log_ssl_noise);
507+ PATCH(log_timeouts);
508
509 PATCH(range_requests);
510 PATCH(force_lowercase_filenames);
511@@ -1135,15 +1139,15 @@
512 * - select works everywhere
513 * - linux-* are experimental
514 */
515+#ifdef USE_LINUX_EPOLL
516+ { FDEVENT_HANDLER_LINUX_SYSEPOLL, "linux-sysepoll" },
517+#endif
518 #ifdef USE_POLL
519 { FDEVENT_HANDLER_POLL, "poll" },
520 #endif
521 #ifdef USE_SELECT
522 { FDEVENT_HANDLER_SELECT, "select" },
523 #endif
524-#ifdef USE_LINUX_EPOLL
525- { FDEVENT_HANDLER_LINUX_SYSEPOLL, "linux-sysepoll" },
526-#endif
527 #ifdef USE_LINUX_SIGIO
528 { FDEVENT_HANDLER_LINUX_RTSIG, "linux-rtsig" },
529 #endif
530Index: src/mod_evhost.c
531===================================================================
532--- src/mod_evhost.c (.../tags/lighttpd-1.4.23) (revision 2613)
533+++ src/mod_evhost.c (.../branches/lighttpd-1.4.x) (revision 2613)
534@@ -213,7 +213,7 @@
535 if (colon != ptr) {
536 ds = data_string_init();
537 buffer_copy_string_len(ds->key,CONST_STR_LEN("%"));
538- buffer_append_long(ds->key, i++);
539+ buffer_append_long(ds->key, i /* ++ */);
540 buffer_copy_string_len(ds->value,ptr,colon-ptr);
541
542 array_insert_unique(host,(data_unset *)ds);
543@@ -294,10 +294,10 @@
544 char *colon = strchr(con->uri.authority->ptr, ':');
545
546 if(colon == NULL) {
547- buffer_append_string_buffer(p->tmp_buf, con->uri.authority); // adds fqdn
548+ buffer_append_string_buffer(p->tmp_buf, con->uri.authority); /* adds fqdn */
549 } else {
550 /* strip the port out of the authority-part of the URI scheme */
551- buffer_append_string_len(p->tmp_buf, con->uri.authority->ptr, colon - con->uri.authority->ptr); // adds fqdn
552+ buffer_append_string_len(p->tmp_buf, con->uri.authority->ptr, colon - con->uri.authority->ptr); /* adds fqdn */
553 }
554 } else if (NULL != (ds = (data_string *)array_get_element(parsed_host,p->conf.path_pieces[i]->ptr))) {
555 if (ds->value->used) {
556Index: src/splaytree.c
557===================================================================
558--- src/splaytree.c (.../tags/lighttpd-1.4.23) (revision 2613)
559+++ src/splaytree.c (.../branches/lighttpd-1.4.x) (revision 2613)
560@@ -61,12 +61,11 @@
561 * size fields are maintained */
562 splay_tree * splaytree_splay (splay_tree *t, int i) {
563 splay_tree N, *l, *r, *y;
564- int comp, root_size, l_size, r_size;
565+ int comp, l_size, r_size;
566
567 if (t == NULL) return t;
568 N.left = N.right = NULL;
569 l = r = &N;
570- root_size = node_size(t);
571 l_size = r_size = 0;
572
573 for (;;) {
574Index: src/lemon.c
575===================================================================
576--- src/lemon.c (.../tags/lighttpd-1.4.23) (revision 2613)
577+++ src/lemon.c (.../branches/lighttpd-1.4.x) (revision 2613)
578@@ -39,6 +39,12 @@
579 # endif
580 #endif
581
582+#if __GNUC__ > 2
583+#define NORETURN __attribute__ ((__noreturn__))
584+#else
585+#define NORETURN
586+#endif
587+
588 /* #define PRIVATE static */
589 #define PRIVATE static
590
591@@ -51,7 +57,7 @@
592 char *msort();
593 extern void *malloc();
594
595-extern void memory_error();
596+extern void memory_error() NORETURN;
597
598 /******** From the file "action.h" *************************************/
599 struct action *Action_new();
600@@ -59,7 +65,7 @@
601 void Action_add();
602
603 /********* From the file "assert.h" ************************************/
604-void myassert();
605+void myassert() NORETURN;
606 #ifndef NDEBUG
607 # define assert(X) if(!(X))myassert(__FILE__,__LINE__)
608 #else
609@@ -1333,7 +1339,7 @@
610 /* Report an out-of-memory condition and abort. This function
611 ** is used mostly by the "MemoryCheck" macro in struct.h
612 */
613-void memory_error(){
614+void memory_error() {
615 fprintf(stderr,"Out of memory. Aborting...\n");
616 exit(1);
617 }
618@@ -1608,7 +1614,6 @@
619 FILE *err;
620 {
621 int spcnt, i;
622- spcnt = 0;
623 if( argv[0] ) fprintf(err,"%s",argv[0]);
624 spcnt = strlen(argv[0]) + 1;
625 for(i=1; i<n && argv[i]; i++){
626@@ -2913,7 +2918,7 @@
627 }else if( sp->destructor ){
628 cp = sp->destructor;
629 fprintf(out,"#line %d \"%s\"\n{",sp->destructorln,lemp->filename);
630- }else if( lemp->vardest ){
631+ }else{
632 cp = lemp->vardest;
633 if( cp==0 ) return;
634 fprintf(out,"#line %d \"%s\"\n{",lemp->vardestln,lemp->filename);
635@@ -3042,7 +3047,7 @@
636 int *plineno; /* Pointer to the line number */
637 int mhflag; /* True if generating makeheaders output */
638 {
639- int lineno = *plineno; /* The line number of the output */
640+ int lineno; /* The line number of the output */
641 char **types; /* A hash table of datatypes */
642 int arraysize; /* Size of the "types" array */
643 int maxdtlength; /* Maximum length of any ".datatype" field. */
644Index: src/mod_scgi.c
645===================================================================
646--- src/mod_scgi.c (.../tags/lighttpd-1.4.23) (revision 2613)
647+++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2613)
648@@ -331,8 +331,21 @@
649
650 int scgi_proclist_sort_down(server *srv, scgi_extension_host *host, scgi_proc *proc);
651
652+static void reset_signals(void) {
653+#ifdef SIGTTOU
654+ signal(SIGTTOU, SIG_DFL);
655+#endif
656+#ifdef SIGTTIN
657+ signal(SIGTTIN, SIG_DFL);
658+#endif
659+#ifdef SIGTSTP
660+ signal(SIGTSTP, SIG_DFL);
661+#endif
662+ signal(SIGHUP, SIG_DFL);
663+ signal(SIGPIPE, SIG_DFL);
664+ signal(SIGUSR1, SIG_DFL);
665+}
666
667-
668 static handler_ctx * handler_ctx_init() {
669 handler_ctx * hctx;
670
671@@ -772,10 +785,8 @@
672 env.used = 0;
673
674 if (scgi_fd != 0) {
675- close(0);
676 dup2(scgi_fd, 0);
677 close(scgi_fd);
678- scgi_fd = 0;
679 }
680
681 /* we don't need the client socket */
682@@ -783,8 +794,6 @@
683 close(fd);
684 }
685
686- openDevNull(STDERR_FILENO);
687-
688 /* build clean environment */
689 if (host->bin_env_copy->used) {
690 for (i = 0; i < host->bin_env_copy->used; i++) {
691@@ -828,6 +837,8 @@
692 buffer_copy_string_len(b, CONST_STR_LEN("exec "));
693 buffer_append_string_buffer(b, host->bin_path);
694
695+ reset_signals();
696+
697 /* exec the cgi */
698 execle("/bin/sh", "sh", "-c", b->ptr, (char *)NULL, env.ptr);
699
700@@ -2163,8 +2174,11 @@
701 int ret;
702
703 /* sanity check */
704- if (!host ||
705- ((!host->host->used || !host->port) && !host->unixsocket->used)) {
706+ if (!host) {
707+ log_error_write(srv, __FILE__, __LINE__, "s", "fatal error: host = NULL");
708+ return HANDLER_ERROR;
709+ }
710+ if (((!host->host->used || !host->port) && !host->unixsocket->used)) {
711 log_error_write(srv, __FILE__, __LINE__, "sxddd",
712 "write-req: error",
713 host,
714@@ -2299,8 +2313,8 @@
715
716 chunkqueue_remove_finished_chunks(hctx->wb);
717
718- if (-1 == ret) {
719- if (errno == ENOTCONN) {
720+ if (ret < 0) {
721+ if (errno == ENOTCONN || ret == -2) {
722 /* the connection got dropped after accept()
723 *
724 * this is most of the time a PHP which dies
725@@ -2325,24 +2339,17 @@
726 */
727
728 log_error_write(srv, __FILE__, __LINE__, "ssosd",
729- "[REPORT ME] connection was dropped after accept(). reconnect() denied:",
730+ "connection was dropped after accept(). reconnect() denied:",
731 "write-offset:", hctx->wb->bytes_out,
732 "reconnect attempts:", hctx->reconnects);
733
734 return HANDLER_ERROR;
735- }
736-
737- if ((errno != EAGAIN) &&
738- (errno != EINTR)) {
739-
740+ } else {
741+ /* -1 == ret => error on our side */
742 log_error_write(srv, __FILE__, __LINE__, "ssd",
743- "write failed:", strerror(errno), errno);
744+ "write failed:", strerror(errno), errno);
745
746 return HANDLER_ERROR;
747- } else {
748- fdevent_event_add(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT);
749-
750- return HANDLER_WAIT_FOR_EVENT;
751 }
752 }
753
754@@ -2469,12 +2476,10 @@
755 }
756
757 static handler_t scgi_connection_close(server *srv, handler_ctx *hctx) {
758- plugin_data *p;
759 connection *con;
760
761 if (NULL == hctx) return HANDLER_GO_ON;
762
763- p = hctx->plugin_data;
764 con = hctx->remote_conn;
765
766 log_error_write(srv, __FILE__, __LINE__, "ssdsd",
767@@ -2724,27 +2729,29 @@
768 /* check if extension matches */
769 for (k = 0; k < p->conf.exts->used; k++) {
770 size_t ct_len;
771+ scgi_extension *ext = p->conf.exts->exts[k];
772
773- extension = p->conf.exts->exts[k];
774+ if (ext->key->used == 0) continue;
775
776- if (extension->key->used == 0) continue;
777+ ct_len = ext->key->used - 1;
778
779- ct_len = extension->key->used - 1;
780-
781 if (s_len < ct_len) continue;
782
783 /* check extension in the form "/scgi_pattern" */
784- if (*(extension->key->ptr) == '/') {
785- if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
786+ if (*(ext->key->ptr) == '/') {
787+ if (strncmp(fn->ptr, ext->key->ptr, ct_len) == 0) {
788+ extension = ext;
789 break;
790- } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
791+ }
792+ } else if (0 == strncmp(fn->ptr + s_len - ct_len, ext->key->ptr, ct_len)) {
793 /* check extension in the form ".fcg" */
794+ extension = ext;
795 break;
796 }
797 }
798
799 /* extension doesn't match */
800- if (k == p->conf.exts->used) {
801+ if (NULL == extension) {
802 return HANDLER_GO_ON;
803 }
804
805Index: src/mod_mysql_vhost.c
806===================================================================
807--- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.23) (revision 2613)
808+++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 2613)
809@@ -259,8 +259,14 @@
810
811 #define FOO(x) (s->x->used ? s->x->ptr : NULL)
812
813+#if MYSQL_VERSION_ID >= 40100
814+ /* CLIENT_MULTI_STATEMENTS first appeared in 4.1 */
815 if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
816+ FOO(mydb), s->port, FOO(mysock), CLIENT_MULTI_STATEMENTS)) {
817+#else
818+ if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
819 FOO(mydb), s->port, FOO(mysock), 0)) {
820+#endif
821 log_error_write(srv, __FILE__, __LINE__, "s", mysql_error(s->mysql));
822
823 return HANDLER_ERROR;
824@@ -369,6 +375,9 @@
825 if (!row || cols < 1) {
826 /* no such virtual host */
827 mysql_free_result(result);
828+#if MYSQL_VERSION_ID >= 40100
829+ while (mysql_next_result(p->conf.mysql) == 0);
830+#endif
831 return HANDLER_GO_ON;
832 }
833
834@@ -402,6 +411,9 @@
835 c->fcgi_offset = c->fcgi_arg->used = 0;
836 }
837 mysql_free_result(result);
838+#if MYSQL_VERSION_ID >= 40100
839+ while (mysql_next_result(p->conf.mysql) == 0);
840+#endif
841
842 /* fix virtual server and docroot */
843 GO_ON: buffer_copy_string_buffer(con->server_name, c->server_name);
844@@ -416,6 +428,9 @@
845 return HANDLER_GO_ON;
846
847 ERR500: if (result) mysql_free_result(result);
848+#if MYSQL_VERSION_ID >= 40100
849+ while (mysql_next_result(p->conf.mysql) == 0);
850+#endif
851 con->http_status = 500; /* Internal Error */
852 con->mode = DIRECT;
853 return HANDLER_FINISHED;
854@@ -424,15 +439,15 @@
855 /* this function is called at dlopen() time and inits the callbacks */
856 int mod_mysql_vhost_plugin_init(plugin *p);
857 int mod_mysql_vhost_plugin_init(plugin *p) {
858- p->version = LIGHTTPD_VERSION_ID;
859- p->name = buffer_init_string("mysql_vhost");
860+ p->version = LIGHTTPD_VERSION_ID;
861+ p->name = buffer_init_string("mysql_vhost");
862
863- p->init = mod_mysql_vhost_init;
864- p->cleanup = mod_mysql_vhost_cleanup;
865- p->handle_request_done = mod_mysql_vhost_handle_connection_close;
866+ p->init = mod_mysql_vhost_init;
867+ p->cleanup = mod_mysql_vhost_cleanup;
868+ p->connection_reset = mod_mysql_vhost_handle_connection_close;
869
870- p->set_defaults = mod_mysql_vhost_set_defaults;
871- p->handle_docroot = mod_mysql_vhost_handle_docroot;
872+ p->set_defaults = mod_mysql_vhost_set_defaults;
873+ p->handle_docroot = mod_mysql_vhost_handle_docroot;
874
875 return 0;
876 }
877@@ -441,7 +456,7 @@
878 int mod_mysql_vhost_plugin_init(plugin *p);
879 int mod_mysql_vhost_plugin_init(plugin *p) {
880 p->version = LIGHTTPD_VERSION_ID;
881- p->name = buffer_init_string("mysql_vhost");
882+ p->name = buffer_init_string("mysql_vhost");
883
884 return 0;
885 }
886Index: src/request.c
887===================================================================
888--- src/request.c (.../tags/lighttpd-1.4.23) (revision 2613)
889+++ src/request.c (.../branches/lighttpd-1.4.x) (revision 2613)
890@@ -111,7 +111,7 @@
891
892 /* check the first character at right of the dot */
893 if (is_ip == 0) {
894- if (!light_isalpha(host->ptr[i+1])) {
895+ if (!light_isalnum(host->ptr[i+1])) {
896 return -1;
897 }
898 } else if (!light_isdigit(host->ptr[i+1])) {
899@@ -133,7 +133,7 @@
900 }
901 } else if (i == 0) {
902 /* the first character of the hostname */
903- if (!light_isalpha(c)) {
904+ if (!light_isalnum(c)) {
905 return -1;
906 }
907 label_len++;
908@@ -540,8 +540,8 @@
909 con->response.keep_alive = 0;
910 con->keep_alive = 0;
911
912- log_error_write(srv, __FILE__, __LINE__, "s", "no uri specified -> 400");
913 if (srv->srvconf.log_request_header_on_error) {
914+ log_error_write(srv, __FILE__, __LINE__, "s", "no uri specified -> 400");
915 log_error_write(srv, __FILE__, __LINE__, "Sb",
916 "request-header:\n",
917 con->request.request);
918Index: src/network_backends.h
919===================================================================
920--- src/network_backends.h (.../tags/lighttpd-1.4.23) (revision 2613)
921+++ src/network_backends.h (.../branches/lighttpd-1.4.x) (revision 2613)
922@@ -45,6 +45,11 @@
923
924 #include "base.h"
925
926+/* return values:
927+ * >= 0 : chunks completed
928+ * -1 : error (on our side)
929+ * -2 : remote close
930+ */
931
932 int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq);
933 int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkqueue *cq);
934Index: src/mod_rrdtool.c
935===================================================================
936--- src/mod_rrdtool.c (.../tags/lighttpd-1.4.23) (revision 2613)
937+++ src/mod_rrdtool.c (.../branches/lighttpd-1.4.x) (revision 2613)
938@@ -139,10 +139,8 @@
939
940 args[i++] = p->conf.path_rrdtool_bin->ptr;
941 args[i++] = dash;
942- args[i++] = NULL;
943+ args[i ] = NULL;
944
945- openDevNull(STDERR_FILENO);
946-
947 /* we don't need the client socket */
948 for (i = 3; i < 256; i++) {
949 close(i);
950@@ -268,7 +266,7 @@
951 "RRA:MIN:0.5:24:775 "
952 "RRA:MIN:0.5:288:797\n"));
953
954- if (-1 == (r = safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
955+ if (-1 == (safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
956 log_error_write(srv, __FILE__, __LINE__, "ss",
957 "rrdtool-write: failed", strerror(errno));
958
959Index: src/stat_cache.c
960===================================================================
961--- src/stat_cache.c (.../tags/lighttpd-1.4.23) (revision 2613)
962+++ src/stat_cache.c (.../branches/lighttpd-1.4.x) (revision 2613)
963@@ -503,12 +503,10 @@
964 }
965
966 if (NULL == sce) {
967- int osize = 0;
968+#ifdef DEBUG_STAT_CACHE
969+ int osize = splaytree_size(sc->files);
970+#endif
971
972- if (sc->files) {
973- osize = sc->files->size;
974- }
975-
976 sce = stat_cache_entry_init();
977 buffer_copy_string_buffer(sce->name, name);
978
979Index: src/mod_proxy.c
980===================================================================
981--- src/mod_proxy.c (.../tags/lighttpd-1.4.23) (revision 2613)
982+++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2613)
983@@ -756,12 +756,15 @@
984
985 switch(hctx->state) {
986 case PROXY_STATE_INIT:
987+#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
988 if (strstr(host->host->ptr,":")) {
989 if (-1 == (hctx->fd = socket(AF_INET6, SOCK_STREAM, 0))) {
990 log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
991 return HANDLER_ERROR;
992 }
993- } else {
994+ } else
995+#endif
996+ {
997 if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) {
998 log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
999 return HANDLER_ERROR;
1000@@ -842,17 +845,14 @@
1001
1002 chunkqueue_remove_finished_chunks(hctx->wb);
1003
1004- if (-1 == ret) {
1005- if (errno != EAGAIN &&
1006- errno != EINTR) {
1007- log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed:", strerror(errno), errno);
1008+ if (-1 == ret) { /* error on our side */
1009+ log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed:", strerror(errno), errno);
1010
1011- return HANDLER_ERROR;
1012- } else {
1013- fdevent_event_add(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT);
1014+ return HANDLER_WAIT_FOR_EVENT;
1015+ } else if (-2 == ret) { /* remote close */
1016+ log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed, remote connection close:", strerror(errno), errno);
1017
1018- return HANDLER_WAIT_FOR_EVENT;
1019- }
1020+ return HANDLER_WAIT_FOR_EVENT;
1021 }
1022
1023 if (hctx->wb->bytes_out == hctx->wb->bytes_in) {
1024@@ -1107,19 +1107,20 @@
1025
1026 /* check if extension matches */
1027 for (k = 0; k < p->conf.extensions->used; k++) {
1028+ data_array *ext = NULL;
1029 size_t ct_len;
1030
1031- extension = (data_array *)p->conf.extensions->data[k];
1032+ ext = (data_array *)p->conf.extensions->data[k];
1033
1034- if (extension->key->used == 0) continue;
1035+ if (ext->key->used == 0) continue;
1036
1037- ct_len = extension->key->used - 1;
1038+ ct_len = ext->key->used - 1;
1039
1040 if (s_len < ct_len) continue;
1041
1042 /* check extension in the form "/proxy_pattern" */
1043- if (*(extension->key->ptr) == '/') {
1044- if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
1045+ if (*(ext->key->ptr) == '/') {
1046+ if (strncmp(fn->ptr, ext->key->ptr, ct_len) == 0) {
1047 if (s_len > ct_len + 1) {
1048 char *pi_offset;
1049
1050@@ -1127,15 +1128,17 @@
1051 path_info_offset = pi_offset - fn->ptr;
1052 }
1053 }
1054+ extension = ext;
1055 break;
1056 }
1057- } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
1058+ } else if (0 == strncmp(fn->ptr + s_len - ct_len, ext->key->ptr, ct_len)) {
1059 /* check extension in the form ".fcg" */
1060+ extension = ext;
1061 break;
1062 }
1063 }
1064
1065- if (k == p->conf.extensions->used) {
1066+ if (NULL == extension) {
1067 return HANDLER_GO_ON;
1068 }
1069
1070Index: src/Makefile.am
1071===================================================================
1072--- src/Makefile.am (.../tags/lighttpd-1.4.23) (revision 2613)
1073+++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2613)
1074@@ -13,14 +13,14 @@
1075 versionstamp:
1076 @test -f versionstamp.h || touch versionstamp.h; \
1077 REVISION=""; \
1078- if test -x "`which svnversion`"; then \
1079- REVISION="$$(LANG=C svnversion "$(top_srcdir)" 2>/dev/null || echo exported)"; \
1080+ if test -d "$(top_srcdir)/.svn" -a -x "`which svnversion`"; then \
1081+ REVISION="$$(LANG= LC_ALL=C svnversion "$(top_srcdir)" 2>/dev/null || echo exported)"; \
1082 if test "$$REVISION" = "exported"; then \
1083 REVISION=""; \
1084 fi; \
1085 fi; \
1086 if test -z "$$REVISION" -a -x "`which git`"; then \
1087- REVISION="$$(cd "$(top_srcdir)"; LANG=C git describe --always 2>/dev/null || echo)"; \
1088+ REVISION="$$(cd "$(top_srcdir)"; LANG= LC_ALL=C git describe --always 2>/dev/null || echo)"; \
1089 fi; \
1090 if test -n "$$REVISION"; then \
1091 echo "#define REPO_VERSION \"-devel-$$REVISION\"" > versionstamp.h.tmp; \
1092Index: src/mod_expire.c
1093===================================================================
1094--- src/mod_expire.c (.../tags/lighttpd-1.4.23) (revision 2613)
1095+++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 2613)
1096@@ -342,7 +342,7 @@
1097 buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
1098 buffer_append_long(p->expire_tstmp, expires - srv->cur_ts); /* as expires >= srv->cur_ts the difference is >= 0 */
1099
1100- response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
1101+ response_header_insert(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
1102
1103 return HANDLER_GO_ON;
1104 }
1105Index: src/http_auth.c
1106===================================================================
1107--- src/http_auth.c (.../tags/lighttpd-1.4.23) (revision 2613)
1108+++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 2613)
1109@@ -918,15 +918,15 @@
1110 char a1[256];
1111 char a2[256];
1112
1113- char *username;
1114- char *realm;
1115- char *nonce;
1116- char *uri;
1117- char *algorithm;
1118- char *qop;
1119- char *cnonce;
1120- char *nc;
1121- char *respons;
1122+ char *username = NULL;
1123+ char *realm = NULL;
1124+ char *nonce = NULL;
1125+ char *uri = NULL;
1126+ char *algorithm = NULL;
1127+ char *qop = NULL;
1128+ char *cnonce = NULL;
1129+ char *nc = NULL;
1130+ char *respons = NULL;
1131
1132 char *e, *c;
1133 const char *m = NULL;
1134@@ -967,15 +967,9 @@
1135 dkv[6].ptr = &cnonce;
1136 dkv[7].ptr = &nc;
1137 dkv[8].ptr = &respons;
1138- dkv[9].ptr = NULL;
1139
1140 UNUSED(req);
1141
1142- for (i = 0; dkv[i].key; i++) {
1143- *(dkv[i].ptr) = NULL;
1144- }
1145-
1146-
1147 if (p->conf.auth_backend != AUTH_BACKEND_HTDIGEST &&
1148 p->conf.auth_backend != AUTH_BACKEND_PLAIN) {
1149 log_error_write(srv, __FILE__, __LINE__, "s",
1150Index: src/mod_redirect.c
1151===================================================================
1152--- src/mod_redirect.c (.../tags/lighttpd-1.4.23) (revision 2613)
1153+++ src/mod_redirect.c (.../branches/lighttpd-1.4.x) (revision 2613)
1154@@ -203,7 +203,7 @@
1155 }
1156 } else {
1157 const char **list;
1158- size_t start, end;
1159+ size_t start;
1160 size_t k;
1161
1162 /* it matched */
1163@@ -213,17 +213,15 @@
1164
1165 buffer_reset(p->location);
1166
1167- start = 0; end = pattern_len;
1168+ start = 0;
1169 for (k = 0; k < pattern_len; k++) {
1170 if (pattern[k] == '$' || pattern[k] == '%') {
1171 /* got one */
1172
1173 size_t num = pattern[k + 1] - '0';
1174
1175- end = k;
1176+ buffer_append_string_len(p->location, pattern + start, k - start);
1177
1178- buffer_append_string_len(p->location, pattern + start, end - start);
1179-
1180 if (!isdigit((unsigned char)pattern[k + 1])) {
1181 /* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
1182 buffer_append_string_len(p->location, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
1183Index: src/mod_webdav.c
1184===================================================================
1185--- src/mod_webdav.c (.../tags/lighttpd-1.4.23) (revision 2613)
1186+++ src/mod_webdav.c (.../branches/lighttpd-1.4.x) (revision 2613)
1187@@ -1096,6 +1096,7 @@
1188 }
1189 #endif
1190
1191+#ifdef USE_LOCKS
1192 static int webdav_lockdiscovery(server *srv, connection *con,
1193 buffer *locktoken, const char *lockscope, const char *locktype, int depth) {
1194
1195@@ -1150,6 +1151,8 @@
1196
1197 return 0;
1198 }
1199+#endif
1200+
1201 /**
1202 * check if resource is having the right locks to access to resource
1203 *
1204Index: src/configparser.y
1205===================================================================
1206--- src/configparser.y (.../tags/lighttpd-1.4.23) (revision 2613)
1207+++ src/configparser.y (.../branches/lighttpd-1.4.x) (revision 2613)
1208@@ -72,7 +72,7 @@
1209 op1->free(op1);
1210 return (data_unset *)ds;
1211 } else {
1212- fprintf(stderr, "data type mismatch, cannot be merge\n");
1213+ fprintf(stderr, "data type mismatch, cannot merge\n");
1214 return NULL;
1215 }
1216 }
1217@@ -193,7 +193,6 @@
1218 du = configparser_merge_data(du, B);
1219 if (NULL == du) {
1220 ctx->ok = 0;
1221- du->free(du);
1222 }
1223 else {
1224 buffer_copy_string_buffer(du->key, A);
1225Index: src/mod_status.c
1226===================================================================
1227--- src/mod_status.c (.../tags/lighttpd-1.4.23) (revision 2613)
1228+++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2613)
1229@@ -438,7 +438,7 @@
1230
1231 buffer_append_string_len(b, CONST_STR_LEN(
1232 "<hr />\n<pre><b>legend</b>\n"
1233- ". = connect, C = close, E = hard error\n"
1234+ ". = connect, C = close, E = hard error, k = keep-alive\n"
1235 "r = read, R = read-POST, W = write, h = handle-request\n"
1236 "q = request-start, Q = request-end\n"
1237 "s = response-start, S = response-end\n"));
1238@@ -449,8 +449,14 @@
1239
1240 for (j = 0; j < srv->conns->used; j++) {
1241 connection *c = srv->conns->ptr[j];
1242- const char *state = connection_get_short_state(c->state);
1243+ const char *state;
1244
1245+ if (CON_STATE_READ == c->state && c->request.orig_uri->used > 0) {
1246+ state = "k";
1247+ } else {
1248+ state = connection_get_short_state(c->state);
1249+ }
1250+
1251 buffer_append_string_len(b, state, 1);
1252
1253 if (((j + 1) % 50) == 0) {
1254@@ -497,7 +503,11 @@
1255
1256 buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
1257
1258- buffer_append_string(b, connection_get_state(c->state));
1259+ if (CON_STATE_READ == c->state && c->request.orig_uri->used > 0) {
1260+ buffer_append_string_len(b, CONST_STR_LEN("keep-alive"));
1261+ } else {
1262+ buffer_append_string(b, connection_get_state(c->state));
1263+ }
1264
1265 buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
1266
1267@@ -611,10 +621,10 @@
1268 }
1269
1270 static handler_t mod_status_handle_server_statistics(server *srv, connection *con, void *p_d) {
1271- plugin_data *p = p_d;
1272- buffer *b = p->module_list;
1273+ buffer *b;
1274 size_t i;
1275 array *st = srv->status;
1276+ UNUSED(p_d);
1277
1278 if (0 == st->used) {
1279 /* we have nothing to send */
1280Index: src/mod_ssi.c
1281===================================================================
1282--- src/mod_ssi.c (.../tags/lighttpd-1.4.23) (revision 2613)
1283+++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2613)
1284@@ -362,7 +362,8 @@
1285 switch(ssicmd) {
1286 case SSI_ECHO: {
1287 /* echo */
1288- int var = 0, enc = 0;
1289+ int var = 0;
1290+ /* int enc = 0; */
1291 const char *var_val = NULL;
1292 stat_cache_entry *sce = NULL;
1293
1294@@ -381,6 +382,7 @@
1295 { NULL, SSI_ECHO_UNSET }
1296 };
1297
1298+/*
1299 struct {
1300 const char *var;
1301 enum { SSI_ENC_UNSET, SSI_ENC_URL, SSI_ENC_NONE, SSI_ENC_ENTITY } type;
1302@@ -391,6 +393,7 @@
1303
1304 { NULL, SSI_ENC_UNSET }
1305 };
1306+*/
1307
1308 for (i = 2; i < n; i += 2) {
1309 if (0 == strcmp(l[i], "var")) {
1310@@ -405,6 +408,7 @@
1311 }
1312 }
1313 } else if (0 == strcmp(l[i], "encoding")) {
1314+/*
1315 int j;
1316
1317 for (j = 0; encvars[j].var; j++) {
1318@@ -413,6 +417,7 @@
1319 break;
1320 }
1321 }
1322+*/
1323 } else {
1324 log_error_write(srv, __FILE__, __LINE__, "sss",
1325 "ssi: unknow attribute for ",
1326Index: src/mod_auth.c
1327===================================================================
1328--- src/mod_auth.c (.../tags/lighttpd-1.4.23) (revision 2613)
1329+++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2613)
1330@@ -468,7 +468,7 @@
1331
1332 if (method == NULL) {
1333 log_error_write(srv, __FILE__, __LINE__, "ss",
1334- "the require field is missing in:",
1335+ "the method field is missing in:",
1336 "auth.require = ( \"...\" => ( ..., \"method\" => \"...\" ) )");
1337 return HANDLER_ERROR;
1338 } else {
1339@@ -483,7 +483,7 @@
1340
1341 if (realm == NULL) {
1342 log_error_write(srv, __FILE__, __LINE__, "ss",
1343- "the require field is missing in:",
1344+ "the realm field is missing in:",
1345 "auth.require = ( \"...\" => ( ..., \"realm\" => \"...\" ) )");
1346 return HANDLER_ERROR;
1347 }
1348Index: src/mod_cml_lua.c
1349===================================================================
1350--- src/mod_cml_lua.c (.../tags/lighttpd-1.4.23) (revision 2613)
1351+++ src/mod_cml_lua.c (.../branches/lighttpd-1.4.x) (revision 2613)
1352@@ -2,6 +2,7 @@
1353 #include <stdio.h>
1354 #include <errno.h>
1355 #include <time.h>
1356+#include <string.h>
1357
1358 #include "mod_cml.h"
1359 #include "mod_cml_funcs.h"
1360Index: src/http-header-glue.c
1361===================================================================
1362--- src/http-header-glue.c (.../tags/lighttpd-1.4.23) (revision 2613)
1363+++ src/http-header-glue.c (.../branches/lighttpd-1.4.x) (revision 2613)
1364@@ -259,7 +259,7 @@
1365 }
1366
1367 if (0 == strncmp(con->request.http_if_modified_since, mtime->ptr, used_len)) {
1368- con->http_status = 304;
1369+ if ('\0' == mtime->ptr[used_len]) con->http_status = 304;
1370 return HANDLER_FINISHED;
1371 } else {
1372 char buf[sizeof("Sat, 23 Jul 2005 21:20:01 GMT")];
1373@@ -281,15 +281,16 @@
1374 strncpy(buf, con->request.http_if_modified_since, used_len);
1375 buf[used_len] = '\0';
1376
1377- tm.tm_isdst = 0;
1378 if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
1379 con->http_status = 412;
1380 con->mode = DIRECT;
1381 return HANDLER_FINISHED;
1382 }
1383+ tm.tm_isdst = 0;
1384 t_header = mktime(&tm);
1385
1386 strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);
1387+ tm.tm_isdst = 0;
1388 t_file = mktime(&tm);
1389
1390 if (t_file > t_header) return HANDLER_GO_ON;
1391@@ -318,7 +319,7 @@
1392 }
1393
1394 if (0 == strncmp(con->request.http_if_modified_since, mtime->ptr, used_len)) {
1395- con->http_status = 304;
1396+ if ('\0' == mtime->ptr[used_len]) con->http_status = 304;
1397 return HANDLER_FINISHED;
1398 } else {
1399 char buf[sizeof("Sat, 23 Jul 2005 21:20:01 GMT")];
1400@@ -331,18 +332,17 @@
1401 strncpy(buf, con->request.http_if_modified_since, used_len);
1402 buf[used_len] = '\0';
1403
1404- tm.tm_isdst = 0;
1405 if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
1406 /**
1407 * parsing failed, let's get out of here
1408 */
1409- log_error_write(srv, __FILE__, __LINE__, "ss",
1410- "strptime() failed on", buf);
1411 return HANDLER_GO_ON;
1412 }
1413+ tm.tm_isdst = 0;
1414 t_header = mktime(&tm);
1415
1416 strptime(mtime->ptr, "%a, %d %b %Y %H:%M:%S GMT", &tm);
1417+ tm.tm_isdst = 0;
1418 t_file = mktime(&tm);
1419
1420 if (t_file > t_header) return HANDLER_GO_ON;
1421Index: src/mod_setenv.c
1422===================================================================
1423--- src/mod_setenv.c (.../tags/lighttpd-1.4.23) (revision 2613)
1424+++ src/mod_setenv.c (.../branches/lighttpd-1.4.x) (revision 2613)
1425@@ -215,7 +215,7 @@
1426 return HANDLER_GO_ON;
1427 }
1428
1429-REQUESTDONE_FUNC(mod_setenv_reset) {
1430+CONNECTION_FUNC(mod_setenv_reset) {
1431 plugin_data *p = p_d;
1432
1433 UNUSED(srv);
1434@@ -240,7 +240,7 @@
1435 p->set_defaults = mod_setenv_set_defaults;
1436 p->cleanup = mod_setenv_free;
1437
1438- p->handle_request_done = mod_setenv_reset;
1439+ p->connection_reset = mod_setenv_reset;
1440
1441 p->data = NULL;
1442
1443Index: src/mod_fastcgi.c
1444===================================================================
1445--- src/mod_fastcgi.c (.../tags/lighttpd-1.4.23) (revision 2613)
1446+++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2613)
1447@@ -122,24 +122,11 @@
1448 *
1449 */
1450
1451- unsigned short min_procs;
1452 unsigned short max_procs;
1453 size_t num_procs; /* how many procs are started */
1454 size_t active_procs; /* how many of them are really running */
1455
1456- unsigned short max_load_per_proc;
1457-
1458 /*
1459- * kick the process from the list if it was not
1460- * used for idle_timeout until min_procs is
1461- * reached. this helps to get the processlist
1462- * small again we had a small peak load.
1463- *
1464- */
1465-
1466- unsigned short idle_timeout;
1467-
1468- /*
1469 * time after a disabled remote connection is tried to be re-enabled
1470 *
1471 *
1472@@ -384,6 +371,21 @@
1473 /* ok, we need a prototype */
1474 static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents);
1475
1476+static void reset_signals(void) {
1477+#ifdef SIGTTOU
1478+ signal(SIGTTOU, SIG_DFL);
1479+#endif
1480+#ifdef SIGTTIN
1481+ signal(SIGTTIN, SIG_DFL);
1482+#endif
1483+#ifdef SIGTSTP
1484+ signal(SIGTSTP, SIG_DFL);
1485+#endif
1486+ signal(SIGHUP, SIG_DFL);
1487+ signal(SIGPIPE, SIG_DFL);
1488+ signal(SIGUSR1, SIG_DFL);
1489+}
1490+
1491 static void fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
1492 buffer_copy_string_len(b, CONST_STR_LEN("fastcgi.backend."));
1493 buffer_append_string_buffer(b, host->id);
1494@@ -993,8 +995,6 @@
1495 close(fcgi_fd);
1496 }
1497
1498- openDevNull(STDERR_FILENO);
1499-
1500 /* we don't need the client socket */
1501 for (i = 3; i < 256; i++) {
1502 close(i);
1503@@ -1054,6 +1054,7 @@
1504 *c = '/';
1505 }
1506
1507+ reset_signals();
1508
1509 /* exec the cgi */
1510 execve(arg.ptr[0], arg.ptr, env.ptr);
1511@@ -1235,20 +1236,17 @@
1512
1513 { "check-local", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 5 */
1514 { "port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 6 */
1515- { "min-procs-not-working", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 7 this is broken for now */
1516- { "max-procs", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
1517- { "max-load-per-proc", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
1518- { "idle-timeout", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
1519- { "disable-time", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
1520+ { "max-procs", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
1521+ { "disable-time", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
1522
1523- { "bin-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
1524- { "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
1525+ { "bin-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
1526+ { "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
1527
1528- { "broken-scriptfilename", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
1529- { "allow-x-send-file", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 15 */
1530- { "strip-request-uri", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 16 */
1531- { "kill-signal", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */
1532- { "fix-root-scriptname", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 18 */
1533+ { "broken-scriptfilename", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
1534+ { "allow-x-send-file", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
1535+ { "strip-request-uri", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
1536+ { "kill-signal", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
1537+ { "fix-root-scriptname", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 15 */
1538
1539 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
1540 };
1541@@ -1267,12 +1265,9 @@
1542 buffer_copy_string_buffer(host->id, da_host->key);
1543
1544 host->check_local = 1;
1545- host->min_procs = 4;
1546 host->max_procs = 4;
1547- host->max_load_per_proc = 1;
1548- host->idle_timeout = 60;
1549 host->mode = FCGI_RESPONDER;
1550- host->disable_time = 60;
1551+ host->disable_time = 1;
1552 host->break_scriptfilename_for_php = 0;
1553 host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */
1554 host->kill_signal = SIGTERM;
1555@@ -1286,19 +1281,16 @@
1556
1557 fcv[5].destination = &(host->check_local);
1558 fcv[6].destination = &(host->port);
1559- fcv[7].destination = &(host->min_procs);
1560- fcv[8].destination = &(host->max_procs);
1561- fcv[9].destination = &(host->max_load_per_proc);
1562- fcv[10].destination = &(host->idle_timeout);
1563- fcv[11].destination = &(host->disable_time);
1564+ fcv[7].destination = &(host->max_procs);
1565+ fcv[8].destination = &(host->disable_time);
1566
1567- fcv[12].destination = host->bin_env;
1568- fcv[13].destination = host->bin_env_copy;
1569- fcv[14].destination = &(host->break_scriptfilename_for_php);
1570- fcv[15].destination = &(host->allow_xsendfile);
1571- fcv[16].destination = host->strip_request_uri;
1572- fcv[17].destination = &(host->kill_signal);
1573- fcv[18].destination = &(host->fix_root_path_name);
1574+ fcv[9].destination = host->bin_env;
1575+ fcv[10].destination = host->bin_env_copy;
1576+ fcv[11].destination = &(host->break_scriptfilename_for_php);
1577+ fcv[12].destination = &(host->allow_xsendfile);
1578+ fcv[13].destination = host->strip_request_uri;
1579+ fcv[14].destination = &(host->kill_signal);
1580+ fcv[15].destination = &(host->fix_root_path_name);
1581
1582 if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
1583 return HANDLER_ERROR;
1584@@ -1355,23 +1347,16 @@
1585 /* a local socket + self spawning */
1586 size_t pno;
1587
1588- /* HACK: just to make sure the adaptive spawing is disabled */
1589- host->min_procs = host->max_procs;
1590-
1591- if (host->min_procs > host->max_procs) host->max_procs = host->min_procs;
1592- if (host->max_load_per_proc < 1) host->max_load_per_proc = 0;
1593-
1594 if (s->debug) {
1595- log_error_write(srv, __FILE__, __LINE__, "ssbsdsbsdsd",
1596+ log_error_write(srv, __FILE__, __LINE__, "ssbsdsbsd",
1597 "--- fastcgi spawning local",
1598 "\n\tproc:", host->bin_path,
1599 "\n\tport:", host->port,
1600 "\n\tsocket", host->unixsocket,
1601- "\n\tmin-procs:", host->min_procs,
1602 "\n\tmax-procs:", host->max_procs);
1603 }
1604
1605- for (pno = 0; pno < host->min_procs; pno++) {
1606+ for (pno = 0; pno < host->max_procs; pno++) {
1607 fcgi_proc *proc;
1608
1609 proc = fastcgi_process_init();
1610@@ -1391,7 +1376,7 @@
1611 "--- fastcgi spawning",
1612 "\n\tport:", host->port,
1613 "\n\tsocket", host->unixsocket,
1614- "\n\tcurrent:", pno, "/", host->min_procs);
1615+ "\n\tcurrent:", pno, "/", host->max_procs);
1616 }
1617
1618 if (fcgi_spawn_connection(srv, p, host, proc)) {
1619@@ -1426,7 +1411,6 @@
1620
1621 host->first = proc;
1622
1623- host->min_procs = 1;
1624 host->max_procs = 1;
1625 }
1626
1627@@ -2739,7 +2723,7 @@
1628 log_error_write(srv, __FILE__, __LINE__, "ssbsdsd",
1629 "--- fastcgi spawning",
1630 "\n\tsocket", proc->connection_name,
1631- "\n\tcurrent:", 1, "/", host->min_procs);
1632+ "\n\tcurrent:", 1, "/", host->max_procs);
1633 }
1634
1635 if (fcgi_spawn_connection(srv, p, host, proc)) {
1636@@ -2778,8 +2762,11 @@
1637 * - tcp socket (do not check host->host->uses, as it may be not set which means INADDR_LOOPBACK)
1638 * - unix socket
1639 */
1640- if (!host ||
1641- (!host->port && !host->unixsocket->used)) {
1642+ if (!host) {
1643+ log_error_write(srv, __FILE__, __LINE__, "s", "fatal error: host = NULL");
1644+ return HANDLER_ERROR;
1645+ }
1646+ if ((!host->port && !host->unixsocket->used)) {
1647 log_error_write(srv, __FILE__, __LINE__, "sxddd",
1648 "write-req: error",
1649 host,
1650@@ -2787,7 +2774,7 @@
1651 host->port,
1652 host->unixsocket->used);
1653
1654- hctx->proc->disabled_until = srv->cur_ts + 10;
1655+ hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
1656 hctx->proc->state = PROC_STATE_DIED;
1657
1658 return HANDLER_ERROR;
1659@@ -2803,7 +2790,7 @@
1660 log_error_write(srv, __FILE__, __LINE__, "ss",
1661 "getsockopt failed:", strerror(errno));
1662
1663- hctx->proc->disabled_until = srv->cur_ts + 10;
1664+ hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
1665 hctx->proc->state = PROC_STATE_DIED;
1666
1667 return HANDLER_ERROR;
1668@@ -2817,7 +2804,7 @@
1669 "socket:", hctx->proc->connection_name);
1670 }
1671
1672- hctx->proc->disabled_until = srv->cur_ts + 5;
1673+ hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
1674
1675 if (hctx->proc->is_local) {
1676 hctx->proc->state = PROC_STATE_DIED_WAIT_FOR_PID;
1677@@ -2910,13 +2897,13 @@
1678 /* cool down the backend, it is overloaded
1679 * -> EAGAIN */
1680
1681- log_error_write(srv, __FILE__, __LINE__, "ssdsd",
1682- "backend is overloaded; we'll disable it for 2 seconds and send the request to another backend instead:",
1683+ log_error_write(srv, __FILE__, __LINE__, "sdssdsd",
1684+ "backend is overloaded; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:",
1685 "reconnects:", hctx->reconnects,
1686 "load:", host->load);
1687
1688
1689- hctx->proc->disabled_until = srv->cur_ts + 2;
1690+ hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
1691 hctx->proc->state = PROC_STATE_OVERLOADED;
1692
1693 fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
1694@@ -2930,18 +2917,18 @@
1695 * - ECONNREFUSED for tcp-ip sockets
1696 * - ENOENT for unix-domain-sockets
1697 *
1698- * for check if the host is back in 5 seconds
1699+ * for check if the host is back in hctx->host->disable_time seconds
1700 * */
1701
1702- hctx->proc->disabled_until = srv->cur_ts + 5;
1703+ hctx->proc->disabled_until = srv->cur_ts + hctx->host->disable_time;
1704 if (hctx->proc->is_local) {
1705 hctx->proc->state = PROC_STATE_DIED_WAIT_FOR_PID;
1706 } else {
1707 hctx->proc->state = PROC_STATE_DIED;
1708 }
1709
1710- log_error_write(srv, __FILE__, __LINE__, "ssdsd",
1711- "backend died; we'll disable it for 5 seconds and send the request to another backend instead:",
1712+ log_error_write(srv, __FILE__, __LINE__, "sdssdsd",
1713+ "backend died; we'll disable it for", hctx->host->disable_time, "seconds and send the request to another backend instead:",
1714 "reconnects:", hctx->reconnects,
1715 "load:", host->load);
1716
1717@@ -3032,11 +3019,6 @@
1718 "reconnect attempts:", hctx->reconnects);
1719
1720 return HANDLER_ERROR;
1721- case EAGAIN:
1722- case EINTR:
1723- fdevent_event_add(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT);
1724-
1725- return HANDLER_WAIT_FOR_EVENT;
1726 default:
1727 log_error_write(srv, __FILE__, __LINE__, "ssd",
1728 "write failed:", strerror(errno), errno);
1729@@ -3266,7 +3248,7 @@
1730 log_error_write(srv, __FILE__, __LINE__, "ssbsdsd",
1731 "--- fastcgi spawning",
1732 "\n\tsocket", proc->connection_name,
1733- "\n\tcurrent:", 1, "/", host->min_procs);
1734+ "\n\tcurrent:", 1, "/", host->max_procs);
1735 }
1736
1737 if (fcgi_spawn_connection(srv, p, host, proc)) {
1738@@ -3489,25 +3471,27 @@
1739 /* check if extension matches */
1740 for (k = 0; k < p->conf.exts->used; k++) {
1741 size_t ct_len; /* length of the config entry */
1742+ fcgi_extension *ext = p->conf.exts->exts[k];
1743
1744- extension = p->conf.exts->exts[k];
1745+ if (ext->key->used == 0) continue;
1746
1747- if (extension->key->used == 0) continue;
1748+ ct_len = ext->key->used - 1;
1749
1750- ct_len = extension->key->used - 1;
1751-
1752 /* check _url_ in the form "/fcgi_pattern" */
1753- if (extension->key->ptr[0] == '/') {
1754+ if (ext->key->ptr[0] == '/') {
1755 if ((ct_len <= con->uri.path->used -1) &&
1756- (strncmp(con->uri.path->ptr, extension->key->ptr, ct_len) == 0))
1757+ (strncmp(con->uri.path->ptr, ext->key->ptr, ct_len) == 0)) {
1758+ extension = ext;
1759 break;
1760- } else if ((ct_len <= s_len) && (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len))) {
1761+ }
1762+ } else if ((ct_len <= s_len) && (0 == strncmp(fn->ptr + s_len - ct_len, ext->key->ptr, ct_len))) {
1763 /* check extension in the form ".fcg" */
1764+ extension = ext;
1765 break;
1766 }
1767 }
1768 /* extension doesn't match */
1769- if (k == p->conf.exts->used) {
1770+ if (NULL == extension) {
1771 return HANDLER_GO_ON;
1772 }
1773 }
1774@@ -3727,107 +3711,12 @@
1775 for (n = 0; n < ex->used; n++) {
1776
1777 fcgi_proc *proc;
1778- unsigned long sum_load = 0;
1779 fcgi_extension_host *host;
1780
1781 host = ex->hosts[n];
1782
1783 fcgi_restart_dead_procs(srv, p, host);
1784
1785- for (proc = host->first; proc; proc = proc->next) {
1786- sum_load += proc->load;
1787- }
1788-
1789- if (host->num_procs &&
1790- host->num_procs < host->max_procs &&
1791- (sum_load / host->num_procs) > host->max_load_per_proc) {
1792- /* overload, spawn new child */
1793- if (p->conf.debug) {
1794- log_error_write(srv, __FILE__, __LINE__, "s",
1795- "overload detected, spawning a new child");
1796- }
1797-
1798- for (proc = host->unused_procs; proc && proc->pid != 0; proc = proc->next);
1799-
1800- if (proc) {
1801- if (proc == host->unused_procs) host->unused_procs = proc->next;
1802-
1803- if (proc->next) proc->next->prev = NULL;
1804-
1805- host->max_id++;
1806- } else {
1807- proc = fastcgi_process_init();
1808- proc->id = host->max_id++;
1809- }
1810-
1811- host->num_procs++;
1812-
1813- if (buffer_is_empty(host->unixsocket)) {
1814- proc->port = host->port + proc->id;
1815- } else {
1816- buffer_copy_string_buffer(proc->unixsocket, host->unixsocket);
1817- buffer_append_string_len(proc->unixsocket, CONST_STR_LEN("-"));
1818- buffer_append_long(proc->unixsocket, proc->id);
1819- }
1820-
1821- if (fcgi_spawn_connection(srv, p, host, proc)) {
1822- log_error_write(srv, __FILE__, __LINE__, "s",
1823- "ERROR: spawning fcgi failed.");
1824- return HANDLER_ERROR;
1825- }
1826-
1827- proc->prev = NULL;
1828- proc->next = host->first;
1829- if (host->first) {
1830- host->first->prev = proc;
1831- }
1832- host->first = proc;
1833- }
1834-
1835- for (proc = host->first; proc; proc = proc->next) {
1836- if (proc->load != 0) break;
1837- if (host->num_procs <= host->min_procs) break;
1838- if (proc->pid == 0) continue;
1839-
1840- if (srv->cur_ts - proc->last_used > host->idle_timeout) {
1841- /* a proc is idling for a long time now,
1842- * terminate it */
1843-
1844- if (p->conf.debug) {
1845- log_error_write(srv, __FILE__, __LINE__, "ssbsd",
1846- "idle-timeout reached; terminating child:",
1847- "socket:", proc->connection_name,
1848- "pid", proc->pid);
1849- }
1850-
1851-
1852- if (proc->next) proc->next->prev = proc->prev;
1853- if (proc->prev) proc->prev->next = proc->next;
1854-
1855- if (proc->prev == NULL) host->first = proc->next;
1856-
1857- proc->prev = NULL;
1858- proc->next = host->unused_procs;
1859-
1860- if (host->unused_procs) host->unused_procs->prev = proc;
1861- host->unused_procs = proc;
1862-
1863- kill(proc->pid, SIGTERM);
1864-
1865- proc->state = PROC_STATE_KILLED;
1866-
1867- log_error_write(srv, __FILE__, __LINE__, "ssbsd",
1868- "killed:",
1869- "socket:", proc->connection_name,
1870- "pid", proc->pid);
1871-
1872- host->num_procs--;
1873-
1874- /* proc is now in unused, let the next second handle the next process */
1875- break;
1876- }
1877- }
1878-
1879 for (proc = host->unused_procs; proc; proc = proc->next) {
1880 int status;
1881
1882Index: src/fdevent_poll.c
1883===================================================================
1884--- src/fdevent_poll.c (.../tags/lighttpd-1.4.23) (revision 2613)
1885+++ src/fdevent_poll.c (.../branches/lighttpd-1.4.x) (revision 2613)
1886@@ -132,7 +132,7 @@
1887 if (poll_r & POLLNVAL) r |= FDEVENT_NVAL;
1888 if (poll_r & POLLPRI) r |= FDEVENT_PRI;
1889
1890- return ev->pollfds[ndx].revents;
1891+ return r;
1892 }
1893
1894 static int fdevent_poll_event_get_fd(fdevents *ev, size_t ndx) {
1895Index: src/fdevent_select.c
1896===================================================================
1897--- src/fdevent_select.c (.../tags/lighttpd-1.4.23) (revision 2613)
1898+++ src/fdevent_select.c (.../branches/lighttpd-1.4.x) (revision 2613)
1899@@ -38,7 +38,7 @@
1900 UNUSED(fde_ndx);
1901
1902 /* we should be protected by max-fds, but you never know */
1903- assert(fd < FD_SETSIZE);
1904+ assert(fd < ((int)FD_SETSIZE));
1905
1906 if (events & FDEVENT_IN) {
1907 FD_SET(fd, &(ev->select_set_read));
1908Index: src/CMakeLists.txt
1909===================================================================
1910Index: src/server.c
1911===================================================================
1912--- src/server.c (.../tags/lighttpd-1.4.23) (revision 2613)
1913+++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2613)
1914@@ -187,6 +187,7 @@
1915 CLEAN(cond_check_buf);
1916
1917 CLEAN(srvconf.errorlog_file);
1918+ CLEAN(srvconf.breakagelog_file);
1919 CLEAN(srvconf.groupname);
1920 CLEAN(srvconf.username);
1921 CLEAN(srvconf.changeroot);
1922@@ -242,8 +243,8 @@
1923 srv->srvconf.reject_expect_100_with_417 = 1;
1924
1925 /* use syslog */
1926- srv->errorlog_fd = -1;
1927- srv->errorlog_mode = ERRORLOG_STDERR;
1928+ srv->errorlog_fd = STDERR_FILENO;
1929+ srv->errorlog_mode = ERRORLOG_FD;
1930
1931 srv->split_vals = array_init();
1932
1933@@ -271,6 +272,7 @@
1934 CLEAN(cond_check_buf);
1935
1936 CLEAN(srvconf.errorlog_file);
1937+ CLEAN(srvconf.breakagelog_file);
1938 CLEAN(srvconf.groupname);
1939 CLEAN(srvconf.username);
1940 CLEAN(srvconf.changeroot);
1941@@ -717,7 +719,7 @@
1942 }
1943
1944 if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
1945- srv->max_fds = rlim.rlim_cur < FD_SETSIZE - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
1946+ srv->max_fds = rlim.rlim_cur < ((int)FD_SETSIZE) - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
1947 } else {
1948 srv->max_fds = rlim.rlim_cur;
1949 }
1950@@ -730,7 +732,7 @@
1951 #endif
1952 if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
1953 /* don't raise the limit above FD_SET_SIZE */
1954- if (srv->max_fds > FD_SETSIZE - 200) {
1955+ if (srv->max_fds > ((int)FD_SETSIZE) - 200) {
1956 log_error_write(srv, __FILE__, __LINE__, "sd",
1957 "can't raise max filedescriptors above", FD_SETSIZE - 200,
1958 "if event-handler is 'select'. Use 'poll' or something else or reduce server.max-fds.");
1959@@ -780,7 +782,7 @@
1960 * Change group before chroot, when we have access
1961 * to /etc/group
1962 * */
1963- if (srv->srvconf.groupname->used) {
1964+ if (NULL != grp) {
1965 setgid(grp->gr_gid);
1966 setgroups(0, NULL);
1967 if (srv->srvconf.username->used) {
1968@@ -804,7 +806,7 @@
1969 #endif
1970 #ifdef HAVE_PWD_H
1971 /* drop root privs */
1972- if (srv->srvconf.username->used) {
1973+ if (NULL != pwd) {
1974 setuid(pwd->pw_uid);
1975 }
1976 #endif
1977@@ -843,7 +845,7 @@
1978 }
1979
1980 if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
1981- srv->max_fds = rlim.rlim_cur < FD_SETSIZE - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
1982+ srv->max_fds = rlim.rlim_cur < ((int)FD_SETSIZE) - 200 ? rlim.rlim_cur : FD_SETSIZE - 200;
1983 } else {
1984 srv->max_fds = rlim.rlim_cur;
1985 }
1986@@ -857,7 +859,7 @@
1987 #endif
1988 if (srv->event_handler == FDEVENT_HANDLER_SELECT) {
1989 /* don't raise the limit above FD_SET_SIZE */
1990- if (srv->max_fds > FD_SETSIZE - 200) {
1991+ if (srv->max_fds > ((int)FD_SETSIZE) - 200) {
1992 log_error_write(srv, __FILE__, __LINE__, "sd",
1993 "can't raise max filedescriptors above", FD_SETSIZE - 200,
1994 "if event-handler is 'select'. Use 'poll' or something else or reduce server.max-fds.");
1995Index: src/mod_dirlisting.c
1996===================================================================
1997--- src/mod_dirlisting.c (.../tags/lighttpd-1.4.23) (revision 2613)
1998+++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 2613)
1999@@ -198,7 +198,7 @@
2000 data_unset *du;
2001
2002 if (NULL != (du = array_get_element(ca, option))) {
2003- data_array *da = (data_array *)du;
2004+ data_array *da;
2005 size_t j;
2006
2007 if (du->type != TYPE_ARRAY) {
2008Index: src/mod_magnet.c
2009===================================================================
2010--- src/mod_magnet.c (.../tags/lighttpd-1.4.23) (revision 2613)
2011+++ src/mod_magnet.c (.../branches/lighttpd-1.4.x) (revision 2613)
2012@@ -283,17 +283,11 @@
2013 }
2014
2015 static int magnet_reqhdr_get(lua_State *L) {
2016- server *srv;
2017 connection *con;
2018 data_string *ds;
2019
2020 const char *key = luaL_checkstring(L, 2);
2021
2022- lua_pushstring(L, "lighty.srv");
2023- lua_gettable(L, LUA_REGISTRYINDEX);
2024- srv = lua_touserdata(L, -1);
2025- lua_pop(L, 1);
2026-
2027 lua_pushstring(L, "lighty.con");
2028 lua_gettable(L, LUA_REGISTRYINDEX);
2029 con = lua_touserdata(L, -1);
2030Index: src/log.c
2031===================================================================
2032--- src/log.c (.../tags/lighttpd-1.4.23) (revision 2613)
2033+++ src/log.c (.../branches/lighttpd-1.4.x) (revision 2613)
2034@@ -62,7 +62,6 @@
2035 /* create write pipe and spawn process */
2036
2037 int to_log_fds[2];
2038- pid_t pid;
2039
2040 if (pipe(to_log_fds)) {
2041 log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
2042@@ -70,7 +69,7 @@
2043 }
2044
2045 /* fork, execve */
2046- switch (pid = fork()) {
2047+ switch (fork()) {
2048 case 0:
2049 /* child */
2050 close(STDIN_FILENO);
2051@@ -150,14 +149,14 @@
2052 */
2053
2054 int log_error_open(server *srv) {
2055- int close_stderr = 1;
2056-
2057 #ifdef HAVE_SYSLOG_H
2058 /* perhaps someone wants to use syslog() */
2059 openlog("lighttpd", LOG_CONS | LOG_PID, LOG_DAEMON);
2060 #endif
2061- srv->errorlog_mode = ERRORLOG_STDERR;
2062
2063+ srv->errorlog_mode = ERRORLOG_FD;
2064+ srv->errorlog_fd = STDERR_FILENO;
2065+
2066 if (srv->srvconf.errorlog_use_syslog) {
2067 srv->errorlog_mode = ERRORLOG_SYSLOG;
2068 } else if (!buffer_is_empty(srv->srvconf.errorlog_file)) {
2069@@ -171,20 +170,36 @@
2070
2071 log_error_write(srv, __FILE__, __LINE__, "s", "server started");
2072
2073-#ifdef HAVE_VALGRIND_VALGRIND_H
2074- /* don't close stderr for debugging purposes if run in valgrind */
2075- if (RUNNING_ON_VALGRIND) close_stderr = 0;
2076-#endif
2077-
2078- if (srv->errorlog_mode == ERRORLOG_STDERR && srv->srvconf.dont_daemonize) {
2079+ if (srv->errorlog_mode == ERRORLOG_FD && !srv->srvconf.dont_daemonize) {
2080 /* We can only log to stderr in dont-daemonize mode;
2081 * if we do daemonize and no errorlog file is specified, we log into /dev/null
2082 */
2083- close_stderr = 0;
2084+ srv->errorlog_fd = -1;
2085 }
2086
2087- /* move stderr to /dev/null */
2088- if (close_stderr) openDevNull(STDERR_FILENO);
2089+ if (!buffer_is_empty(srv->srvconf.breakagelog_file)) {
2090+ int breakage_fd;
2091+ const char *logfile = srv->srvconf.breakagelog_file->ptr;
2092+
2093+ if (srv->errorlog_mode == ERRORLOG_FD) {
2094+ srv->errorlog_fd = dup(STDERR_FILENO);
2095+#ifdef FD_CLOEXEC
2096+ fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
2097+#endif
2098+ }
2099+
2100+ if (-1 == (breakage_fd = open_logfile_or_pipe(srv, logfile))) {
2101+ return -1;
2102+ }
2103+
2104+ if (STDERR_FILENO != breakage_fd) {
2105+ dup2(breakage_fd, STDERR_FILENO);
2106+ close(breakage_fd);
2107+ }
2108+ } else if (!srv->srvconf.dont_daemonize) {
2109+ /* move stderr to /dev/null */
2110+ openDevNull(STDERR_FILENO);
2111+ }
2112 return 0;
2113 }
2114
2115@@ -235,15 +250,19 @@
2116 switch(srv->errorlog_mode) {
2117 case ERRORLOG_PIPE:
2118 case ERRORLOG_FILE:
2119- close(srv->errorlog_fd);
2120+ case ERRORLOG_FD:
2121+ if (-1 != srv->errorlog_fd) {
2122+ /* don't close STDERR */
2123+ if (STDERR_FILENO != srv->errorlog_fd)
2124+ close(srv->errorlog_fd);
2125+ srv->errorlog_fd = -1;
2126+ }
2127 break;
2128 case ERRORLOG_SYSLOG:
2129 #ifdef HAVE_SYSLOG_H
2130 closelog();
2131 #endif
2132 break;
2133- case ERRORLOG_STDERR:
2134- break;
2135 }
2136
2137 return 0;
2138@@ -255,7 +274,8 @@
2139 switch(srv->errorlog_mode) {
2140 case ERRORLOG_PIPE:
2141 case ERRORLOG_FILE:
2142- case ERRORLOG_STDERR:
2143+ case ERRORLOG_FD:
2144+ if (-1 == srv->errorlog_fd) return 0;
2145 /* cache the generated timestamp */
2146 if (srv->cur_ts != srv->last_generated_debug_ts) {
2147 buffer_prepare_copy(srv->ts_debug_str, 255);
2148@@ -349,13 +369,10 @@
2149 switch(srv->errorlog_mode) {
2150 case ERRORLOG_PIPE:
2151 case ERRORLOG_FILE:
2152+ case ERRORLOG_FD:
2153 buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
2154 write(srv->errorlog_fd, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
2155 break;
2156- case ERRORLOG_STDERR:
2157- buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
2158- write(STDERR_FILENO, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
2159- break;
2160 case ERRORLOG_SYSLOG:
2161 syslog(LOG_ERR, "%s", srv->errorlog_buf->ptr);
2162 break;
2163Index: src/proc_open.c
2164===================================================================
2165--- src/proc_open.c (.../tags/lighttpd-1.4.23) (revision 2613)
2166+++ src/proc_open.c (.../branches/lighttpd-1.4.x) (revision 2613)
2167@@ -309,6 +309,14 @@
2168
2169 if (err) {
2170 proc_read_fd_to_buffer(proc.err.fd, err);
2171+ } else {
2172+ buffer *tmp = buffer_init();
2173+ proc_read_fd_to_buffer(proc.err.fd, tmp);
2174+ if (tmp->used > 0 && write(2, (void*)tmp->ptr, tmp->used) < 0) {
2175+ perror("error writing pipe");
2176+ return -1;
2177+ }
2178+ buffer_free(tmp);
2179 }
2180 pipe_close(&proc.err);
2181
2182Index: tests/.cvsignore
2183===================================================================
2184--- tests/.cvsignore (.../tags/lighttpd-1.4.23) (revision 2613)
2185+++ tests/.cvsignore (.../branches/lighttpd-1.4.x) (revision 2613)
2186@@ -1,6 +0,0 @@
2187-Makefile.in
2188-Makefile
2189-.deps
2190-.libs
2191-fcgi-auth
2192-fcgi-responder
2193Index: tests/bug-12.conf
2194===================================================================
2195--- tests/bug-12.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2196+++ tests/bug-12.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2197@@ -8,6 +8,7 @@
2198 ## bind to localhost (default: all interfaces)
2199 server.bind = "localhost"
2200 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2201+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2202 server.name = "www.example.org"
2203 server.tag = "Apache 1.3.29"
2204
2205Index: tests/fastcgi-10.conf
2206===================================================================
2207--- tests/fastcgi-10.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2208+++ tests/fastcgi-10.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2209@@ -6,6 +6,7 @@
2210 ## bind to localhost (default: all interfaces)
2211 server.bind = "localhost"
2212 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2213+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2214 server.name = "www.example.org"
2215 server.tag = "Apache 1.3.29"
2216
2217Index: tests/bug-06.conf
2218===================================================================
2219--- tests/bug-06.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2220+++ tests/bug-06.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2221@@ -8,6 +8,7 @@
2222 ## bind to localhost (default: all interfaces)
2223 server.bind = "localhost"
2224 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2225+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2226 server.name = "www.example.org"
2227 server.tag = "Apache 1.3.29"
2228
2229Index: tests/mod-extforward.conf
2230===================================================================
2231--- tests/mod-extforward.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2232+++ tests/mod-extforward.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2233@@ -10,6 +10,7 @@
2234 ## bind to localhost (default: all interfaces)
2235 server.bind = "localhost"
2236 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2237+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2238 server.name = "www.example.org"
2239 server.tag = "Apache 1.3.29"
2240
2241Index: tests/var-include.conf
2242===================================================================
2243--- tests/var-include.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2244+++ tests/var-include.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2245@@ -10,6 +10,7 @@
2246 ## bind to localhost (default: all interfaces)
2247 server.bind = "localhost"
2248 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2249+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2250 server.name = "www.example.org"
2251 server.tag = "Apache 1.3.29"
2252
2253Index: tests/404-handler.conf
2254===================================================================
2255--- tests/404-handler.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2256+++ tests/404-handler.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2257@@ -10,6 +10,7 @@
2258 ## bind to localhost (default: all interfaces)
2259 server.bind = "localhost"
2260 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2261+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2262 server.name = "www.example.org"
2263 server.tag = "Apache 1.3.29"
2264
2265Index: tests/lowercase.conf
2266===================================================================
2267--- tests/lowercase.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2268+++ tests/lowercase.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2269@@ -6,6 +6,7 @@
2270 ## bind to localhost (default: all interfaces)
2271 server.bind = "localhost"
2272 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2273+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2274
2275 server.force-lowercase-filenames = "enable"
2276
2277Index: tests/condition.conf
2278===================================================================
2279--- tests/condition.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2280+++ tests/condition.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2281@@ -10,6 +10,7 @@
2282 ## bind to localhost (default: all interfaces)
2283 server.bind = "localhost"
2284 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2285+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2286 server.name = "www.example.org"
2287 server.tag = "Apache 1.3.29"
2288
2289Index: tests/fastcgi-13.conf
2290===================================================================
2291--- tests/fastcgi-13.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2292+++ tests/fastcgi-13.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2293@@ -10,6 +10,7 @@
2294 ## bind to localhost (default: all interfaces)
2295 server.bind = "localhost"
2296 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2297+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2298 server.name = "www.example.org"
2299 server.tag = "Apache 1.3.29"
2300
2301Index: tests/mod-compress.conf
2302===================================================================
2303--- tests/mod-compress.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2304+++ tests/mod-compress.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2305@@ -11,6 +11,7 @@
2306 ## bind to localhost (default: all interfaces)
2307 server.bind = "localhost"
2308 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2309+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2310 server.name = "www.example.org"
2311
2312 server.modules = (
2313Index: tests/lighttpd.conf
2314===================================================================
2315--- tests/lighttpd.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2316+++ tests/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2317@@ -13,6 +13,7 @@
2318 ## bind to localhost (default: all interfaces)
2319 server.bind = "localhost"
2320 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2321+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2322 server.name = "www.example.org"
2323 server.tag = "Apache 1.3.29"
2324
2325Index: tests/fastcgi-responder.conf
2326===================================================================
2327--- tests/fastcgi-responder.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2328+++ tests/fastcgi-responder.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2329@@ -15,6 +15,7 @@
2330 ## bind to localhost (default: all interfaces)
2331 server.bind = "localhost"
2332 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2333+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2334 server.name = "www.example.org"
2335 server.tag = "Apache 1.3.29"
2336
2337Index: tests/fastcgi-auth.conf
2338===================================================================
2339--- tests/fastcgi-auth.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2340+++ tests/fastcgi-auth.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2341@@ -12,6 +12,7 @@
2342 ## bind to localhost (default: all interfaces)
2343 server.bind = "localhost"
2344 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2345+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2346 server.name = "www.example.org"
2347 server.tag = "Apache 1.3.29"
2348
2349Index: tests/proxy.conf
2350===================================================================
2351--- tests/proxy.conf (.../tags/lighttpd-1.4.23) (revision 2613)
2352+++ tests/proxy.conf (.../branches/lighttpd-1.4.x) (revision 2613)
2353@@ -6,6 +6,7 @@
2354 ## bind to localhost (default: all interfaces)
2355 server.bind = "localhost"
2356 server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2357+server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log"
2358 server.name = "www.example.org"
2359 server.tag = "Proxy"
2360
2361Index: tests/LightyTest.pm
2362===================================================================
2363--- tests/LightyTest.pm (.../tags/lighttpd-1.4.23) (revision 2613)
2364+++ tests/LightyTest.pm (.../branches/lighttpd-1.4.x) (revision 2613)
2365@@ -87,14 +87,21 @@
2366 my $self = shift;
2367 my $port = shift;
2368 my $child = shift;
2369+ my $timeout = 5*10; # 5 secs, select waits 0.1 s
2370
2371 while (0 == $self->listening_on($port)) {
2372 select(undef, undef, undef, 0.1);
2373+ $timeout--;
2374
2375 # the process is gone, we failed
2376 if (0 != waitpid($child, WNOHANG)) {
2377 return -1;
2378 }
2379+ if (0 >= $timeout) {
2380+ diag("Timeout while trying to connect; killing child");
2381+ kill('TERM', $child);
2382+ return -1;
2383+ }
2384 }
2385
2386 return 0;
2387Index: configure.ac
2388===================================================================
2389--- configure.ac (.../tags/lighttpd-1.4.23) (revision 2613)
2390+++ configure.ac (.../branches/lighttpd-1.4.x) (revision 2613)
2391@@ -1,7 +1,7 @@
2392 # -*- Autoconf -*-
2393 # Process this file with autoconf to produce a configure script.
2394 AC_PREREQ(2.57)
2395-AC_INIT([lighttpd], [1.4.23], [contact@lighttpd.net])
2396+AC_INIT([lighttpd], [1.4.24], [contact@lighttpd.net])
2397 AC_CONFIG_SRCDIR([src/server.c])
2398 AC_CONFIG_HEADER([config.h])
2399
2400@@ -417,12 +417,18 @@
2401 AC_DEFINE([HAVE_LUA], [1], [liblua])
2402 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
2403 ],[
2404- # for debian based systems
2405- PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
2406- AC_DEFINE([HAVE_LUA], [1], [liblua])
2407- AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
2408- ])
2409+ # for debian based systems
2410+ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
2411+ AC_DEFINE([HAVE_LUA], [1], [liblua])
2412+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
2413+ ],[
2414+ # for freebsd
2415+ PKG_CHECK_MODULES(LUA, lua-5.1 >= 5.1, [
2416+ AC_DEFINE([HAVE_LUA], [1], [liblua])
2417+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
2418 ])
2419+ ])
2420+ ])
2421
2422 AC_SUBST(LUA_CFLAGS)
2423 AC_SUBST(LUA_LIBS)
2424Index: doc/.cvsignore
2425===================================================================
2426--- doc/.cvsignore (.../tags/lighttpd-1.4.23) (revision 2613)
2427+++ doc/.cvsignore (.../branches/lighttpd-1.4.x) (revision 2613)
2428@@ -1,4 +0,0 @@
2429-Makefile.in
2430-Makefile
2431-*.html
2432-*.ps.gz
2433Index: doc/fastcgi.txt
2434===================================================================
2435--- doc/fastcgi.txt (.../tags/lighttpd-1.4.23) (revision 2613)
2436+++ doc/fastcgi.txt (.../branches/lighttpd-1.4.x) (revision 2613)
2437@@ -95,23 +95,22 @@
2438 (
2439 ( "host" => <string> ,
2440 "port" => <integer> ,
2441- "socket" => <string>, # either socket
2442- # or host+port
2443- "bin-path" => <string>, # OPTIONAL
2444- "bin-environment" => <array>, # OPTIONAL
2445- "bin-copy-environment" => <array>, # OPTIONAL
2446+ "socket" => <string>, # either socket
2447+ # or host+port
2448+ "bin-path" => <string>, # OPTIONAL
2449+ "bin-environment" => <array>, # OPTIONAL
2450+ "bin-copy-environment" => <array>, # OPTIONAL
2451 "mode" => <string>, # OPTIONAL
2452 "docroot" => <string> , # OPTIONAL if "mode"
2453- # is not "authorizer"
2454+ # is not "authorizer"
2455 "check-local" => <string>, # OPTIONAL
2456- "min-procs" => <integer>, # OPTIONAL
2457- "max-procs" => <integer>, # OPTIONAL
2458- "max-load-per-proc" => <integer>, # OPTIONAL
2459- "idle-timeout" => <integer>, # OPTIONAL
2460- "broken-scriptfilename" => <boolean>, # OPTIONAL
2461+ "max-procs" => <integer>, # OPTIONAL
2462+ "broken-scriptfilename" => <boolean>, # OPTIONAL
2463 "disable-time" => <integer>, # optional
2464- "allow-x-send-file" => <boolean> # optional
2465- ),
2466+ "allow-x-send-file" => <boolean>, # optional
2467+ "kill-signal" => <integer>, # OPTIONAL
2468+ "fix-root-scriptname" => <boolean>,
2469+ # OPTIONAL
2470 ( "host" => ...
2471 )
2472 )
2473@@ -127,42 +126,38 @@
2474 :"socket": path to the unix-domain socket
2475 :"mode": is the FastCGI protocol mode.
2476 Default is "responder", also "authorizer"
2477- mode is implemented.
2478+ mode is implemented.
2479 :"docroot": is optional and is the docroot on the remote
2480 host for default "responder" mode. For
2481- "authorizer" mode it is MANDATORY and it points
2482- to docroot for authorized requests. For security
2483- reasons it is recommended to keep this docroot
2484+ "authorizer" mode it is MANDATORY and it points
2485+ to docroot for authorized requests. For security
2486+ reasons it is recommended to keep this docroot
2487 outside of server.document-root tree.
2488 :"check-local": is optional and may be "enable" (default) or
2489 "disable". If enabled the server first check
2490- for a file in local server.document-root tree
2491- and return 404 (Not Found) if no such file.
2492+ for a file in local server.document-root tree
2493+ and return 404 (Not Found) if no such file.
2494 If disabled, the server forward request to
2495- FastCGI interface without this check.
2496+ FastCGI interface without this check.
2497 :"broken-scriptfilename": breaks SCRIPT_FILENAME in a wat that
2498 PHP can extract PATH_INFO from it (default: disabled)
2499 :"disable-time": time to wait before a disabled backend is checked
2500 again
2501 :"allow-x-send-file": controls if X-LIGHTTPD-send-file headers
2502 are allowed
2503+ :"fix-root-scriptname": fix broken path-info split for "/" extension ("prefix")
2504
2505 If bin-path is set:
2506
2507- :"min-procs": sets the minium processes to start
2508 :"max-procs": the upper limit of the processess to start
2509- :"max-load-per-proc": maximum number of waiting processes on
2510- average per process before a new process is
2511- spawned
2512- :"idle-timeout": number of seconds before a unused process
2513- gets terminated
2514 :"bin-environment": put an entry into the environment of
2515 the started process
2516 :"bin-copy-environement": clean up the environment and copy
2517 only the specified entries into the fresh
2518 environment of the spawn process
2519+ :"kill-signal": signal to terminate the FastCGI process with,
2520+ defauls to SIGTERM
2521
2522-
2523 Examples
2524 --------
2525
2526@@ -171,11 +166,11 @@
2527 fastcgi.server = ( ".php" =>
2528 (( "host" => "127.0.0.1",
2529 "port" => 1026,
2530- "bin-path" => "/usr/local/bin/php"
2531+ "bin-path" => "/usr/local/bin/php"
2532 )),
2533 ".php4" =>
2534 (( "host" => "127.0.0.1",
2535- "port" => 1026
2536+ "port" => 1026
2537 ))
2538 )
2539
2540@@ -183,10 +178,10 @@
2541
2542 fastcgi.server = ( "/remote_scripts/" =>
2543 (( "host" => "192.168.0.3",
2544- "port" => 9000,
2545+ "port" => 9000,
2546 "check-local" => "disable",
2547 "docroot" => "/" # remote server may use
2548- # it's own docroot
2549+ # it's own docroot
2550 ))
2551 )
2552
2553@@ -206,7 +201,7 @@
2554
2555 fastcgi.server = ( "/remote_scripts/" =>
2556 (( "host" => "10.0.0.2",
2557- "port" => 9000,
2558+ "port" => 9000,
2559 "docroot" => "/path_to_private_docs",
2560 "mode" => "authorizer"
2561 ))
2562@@ -318,10 +313,10 @@
2563 $ PHP_FCGI_CHILDREN=384 ./lighttpd -f ./lighttpd.conf
2564
2565 fastcgi.server = ( ".php" =>
2566- (( "socket" => "/tmp/php.socket",
2567+ (( "socket" => "/tmp/php.socket",
2568 "bin-path" => "/usr/local/bin/php",
2569 "min-procs" => 1,
2570- "max-procs" => 1,
2571+ "max-procs" => 1,
2572 "max-load-per-proc" => 4,
2573 "idle-timeout" => 20
2574 ))
2575@@ -408,7 +403,7 @@
2576 "PHP_FCGI_CHILDREN" => "16",
2577 "PHP_FCGI_MAX_REQUESTS" => "10000" ),
2578 "bin-copy-environment" => (
2579- "PATH", "SHELL", "USER" )
2580+ "PATH", "SHELL", "USER" )
2581 ))
2582 )
2583
2584Index: SConstruct
2585===================================================================
2586Index: NEWS
2587===================================================================
2588--- NEWS (.../tags/lighttpd-1.4.23) (revision 2613)
2589+++ NEWS (.../branches/lighttpd-1.4.x) (revision 2613)
2590@@ -3,7 +3,40 @@
2591 NEWS
2592 ====
2593
2594-- 1.4.23 -
2595+- 1.4.24 -
2596+ * Add T_CONFIG_INT for bigger integers from the config (needed for #1966)
2597+ * Use unsigned int (and T_CONFIG_INT) for max_request_size
2598+ * Use unsigned int for secdownload.timeout (fixes #1966)
2599+ * Keep url/host values from connection to display information while keep-alive in mod_status (fixes #1202)
2600+ * Add server.breakagelog, a "special" stderr (fixes #1863)
2601+ * Fix config evaluation for debug.log-timeouts option (#1529)
2602+ * Add "cgi.execute-x-only" to mod_cgi, requires +x for cgi scripts (fixes #2013)
2603+ * Fix FD_SETSIZE comparision warnings
2604+ * Add "lua-5.1" to searched pkg-config names for lua
2605+ * Fix unused function webdav_lockdiscovery in mod_webdav
2606+ * cmake: Fix crypt lib check
2607+ * cmake: Add -export-dynamic to link flags, fixes build on FreeBSD
2608+ * Set FD_CLOEXEC for bound sockets before pipe-logger forks (fixes #2026)
2609+ * Reset ignored signals to SIG_DFL before exec() in fastcgi/scgi (fixes #2029)
2610+ * Show "no uri specified -> 400" error only when "debug.log-request-header-on-error" is enabled (fixes #2030)
2611+ * Fix hanging connection in mod_scgi (fixes #2024)
2612+ * Allow digits in hostnames in more places (fixes #1148)
2613+ * Use connection_reset instead of handle_request_done for cleanup callbacks
2614+ * Change mod_expire to append Cache-Control instead of overwriting it (fixes #1997)
2615+ * Allow all comparisons for $SERVER["socket"] - only bind for "=="
2616+ * Remove strptime failed message (fixes #2031)
2617+ * Fix issues found with clang analyzer
2618+ * Try to fix server.tag issue with localized svnversion
2619+ * Fix handling network-write return values (#2024)
2620+ * Use disable-time in fastcgi for all disables after errors, default is 1sec (fixes #2040)
2621+ * Remove adaptive spawning code from fastcgi (was disabled for a long time)
2622+ * Allow mod_mysql_vhost to use stored procedures (fixes #2011, thx Ben Brown)
2623+ * Fix ipv6 in mod_proxy (fixes #2043)
2624+ * Print errors from include_shell to stderr
2625+ * Set tm.tm_isdst = 0 before mktime() (fixes #2047)
2626+ * Use linux-epoll by default if available (fixes #2021, thx Olaf van der Spek)
2627+
2628+- 1.4.23 - 2009-06-19
2629 * Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)
2630 * New lighttpd man page (moved it to section 8) (fixes #1875)
2631 * Create rrd file for empty rrdfile in mod_rrdtool (#1788)
2632Index: CMakeLists.txt
2633===================================================================
This page took 0.301955 seconds and 4 git commands to generate.