]> git.pld-linux.org Git - packages/lighttpd.git/blame - lighttpd-branch.diff
- up to r2504
[packages/lighttpd.git] / lighttpd-branch.diff
CommitLineData
709c1a0b 1Index: configure.in
54b68997 2===================================================================
9ab53fe1
ER
3Index: src/spawn-fcgi.c
4===================================================================
b57f094a
ER
5--- src/spawn-fcgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
6+++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
7@@ -1,481 +0,0 @@
8-#include <sys/types.h>
9-#include <sys/time.h>
10-#include <sys/stat.h>
11-
12-#include <stdlib.h>
13-#include <string.h>
14-#include <errno.h>
15-#include <stdio.h>
16-#include <unistd.h>
17-#include <fcntl.h>
18-
19-#ifdef HAVE_CONFIG_H
20-#include "config.h"
21-#endif
22-
23-
24-#ifdef HAVE_PWD_H
25-#include <grp.h>
26-#include <pwd.h>
27-#endif
28-
29-#ifdef HAVE_GETOPT_H
30-#include <getopt.h>
31-#endif
32-
33-#define FCGI_LISTENSOCK_FILENO 0
34-
35-#include "sys-socket.h"
36-
37-#ifdef HAVE_SYS_WAIT_H
38-#include <sys/wait.h>
39-#endif
40-
41-/* for solaris 2.5 and netbsd 1.3.x */
42-#ifndef HAVE_SOCKLEN_T
43-typedef int socklen_t;
44-#endif
45-
46-#ifdef HAVE_SYS_UN_H
47-int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int fork_count, int child_count, int pid_fd, int nofork) {
48- int fcgi_fd;
49- int socket_type, status, rc = 0;
50- struct timeval tv = { 0, 100 * 1000 };
51-
52- struct sockaddr_un fcgi_addr_un;
53- struct sockaddr_in fcgi_addr_in;
54- struct sockaddr *fcgi_addr;
55-
56- socklen_t servlen;
57-
58- if (child_count < 2) {
59- child_count = 5;
60- }
61-
62- if (child_count > 256) {
63- child_count = 256;
64- }
65-
66-
67- if (unixsocket) {
68- memset(&fcgi_addr_un, 0, sizeof(fcgi_addr_un));
69-
70- fcgi_addr_un.sun_family = AF_UNIX;
71- strcpy(fcgi_addr_un.sun_path, unixsocket);
72-
73-#ifdef SUN_LEN
74- servlen = SUN_LEN(&fcgi_addr_un);
75-#else
76- /* stevens says: */
77- servlen = strlen(fcgi_addr_un.sun_path) + sizeof(fcgi_addr_un.sun_family);
78-#endif
79- socket_type = AF_UNIX;
80- fcgi_addr = (struct sockaddr *) &fcgi_addr_un;
81- } else {
82- memset(&fcgi_addr_in, 0, sizeof(fcgi_addr_in));
83- fcgi_addr_in.sin_family = AF_INET;
84- if (addr != NULL) {
85- fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
86- } else {
87- fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
88- }
89- fcgi_addr_in.sin_port = htons(port);
90- servlen = sizeof(fcgi_addr_in);
91-
92- socket_type = AF_INET;
93- fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
94- }
95-
96- if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
97- fprintf(stderr, "%s.%d\n",
98- __FILE__, __LINE__);
99- return -1;
100- }
101-
102- if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {
103- /* server is not up, spawn in */
104- pid_t child;
105- int val;
106-
107- if (unixsocket) unlink(unixsocket);
108-
109- close(fcgi_fd);
110-
111- /* reopen socket */
112- if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
113- fprintf(stderr, "%s.%d\n",
114- __FILE__, __LINE__);
115- return -1;
116- }
117-
118- val = 1;
119- if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
120- fprintf(stderr, "%s.%d\n",
121- __FILE__, __LINE__);
122- return -1;
123- }
124-
125- /* create socket */
126- if (-1 == bind(fcgi_fd, fcgi_addr, servlen)) {
127- fprintf(stderr, "%s.%d: bind failed: %s\n",
128- __FILE__, __LINE__,
129- strerror(errno));
130- return -1;
131- }
132-
133- if (-1 == listen(fcgi_fd, 1024)) {
134- fprintf(stderr, "%s.%d: fd = -1\n",
135- __FILE__, __LINE__);
136- return -1;
137- }
138-
139- while (fork_count-- > 0) {
140-
141- if (!nofork) {
142- child = fork();
143- } else {
144- child = 0;
145- }
146-
147- switch (child) {
148- case 0: {
149- char cgi_childs[64];
150- int max_fd = 0;
151-
152- int i = 0;
153-
154- /* loose control terminal */
155- setsid();
156-
157- /* is safe as we limit to 256 childs */
158- sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
159-
160- if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
161- close(FCGI_LISTENSOCK_FILENO);
162- dup2(fcgi_fd, FCGI_LISTENSOCK_FILENO);
163- close(fcgi_fd);
164- }
165-
166- max_fd = open("/dev/null", O_RDWR);
167- close(STDERR_FILENO);
168- dup2(max_fd, STDERR_FILENO);
169- close(max_fd);
170-
171- max_fd = open("/dev/null", O_RDWR);
172- close(STDOUT_FILENO);
173- dup2(max_fd, STDOUT_FILENO);
174- close(max_fd);
175-
176- /* we don't need the client socket */
177- for (i = 3; i < max_fd; i++) {
178- if (i != FCGI_LISTENSOCK_FILENO) close(i);
179- }
180-
181- /* create environment */
182-
183- putenv(cgi_childs);
184-
185- /* fork and replace shell */
186- if (appArgv) {
187- execv(appArgv[0], appArgv);
188-
189- } else {
190- char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
191- strcpy(b, "exec ");
192- strcat(b, appPath);
193-
194- /* exec the cgi */
195- execl("/bin/sh", "sh", "-c", b, (char *)NULL);
196- }
197-
198- exit(errno);
199-
200- break;
201- }
202- case -1:
203- /* error */
204- break;
205- default:
206- /* father */
207-
208- /* wait */
209- select(0, NULL, NULL, NULL, &tv);
210-
211- switch (waitpid(child, &status, WNOHANG)) {
212- case 0:
213- fprintf(stdout, "%s.%d: child spawned successfully: PID: %d\n",
214- __FILE__, __LINE__,
215- child);
216-
217- /* write pid file */
218- if (pid_fd != -1) {
219- /* assume a 32bit pid_t */
220- char pidbuf[12];
221-
222- snprintf(pidbuf, sizeof(pidbuf) - 1, "%d", child);
223-
224- write(pid_fd, pidbuf, strlen(pidbuf));
225- /* avoid eol for the last one */
226- if (fork_count != 0) {
227- write(pid_fd, "\n", 1);
228- }
229- }
230-
231- break;
232- case -1:
233- break;
234- default:
235- if (WIFEXITED(status)) {
236- fprintf(stderr, "%s.%d: child exited with: %d\n",
237- __FILE__, __LINE__, WEXITSTATUS(status));
238- rc = WEXITSTATUS(status);
239- } else if (WIFSIGNALED(status)) {
240- fprintf(stderr, "%s.%d: child signaled: %d\n",
241- __FILE__, __LINE__,
242- WTERMSIG(status));
243- rc = 1;
244- } else {
245- fprintf(stderr, "%s.%d: child died somehow: %d\n",
246- __FILE__, __LINE__,
247- status);
248- rc = status;
249- }
250- }
251-
252- break;
253- }
254- }
255- close(pid_fd);
256- pid_fd = -1;
257- } else {
258- fprintf(stderr, "%s.%d: socket is already used, can't spawn\n",
259- __FILE__, __LINE__);
260- return -1;
261- }
262-
263- close(fcgi_fd);
264-
265- return rc;
266-}
267-
268-
269-void show_version () {
270- char *b = "spawn-fcgi" "-" PACKAGE_VERSION \
271-" - spawns fastcgi processes\n"
272-;
273- write(1, b, strlen(b));
274-}
275-
276-void show_help () {
277- char *b = \
278-"Usage: spawn-fcgi [options] -- <fcgiapp> [fcgi app arguments]\n" \
279-"\n" \
280-"spawn-fcgi v" PACKAGE_VERSION " - spawns fastcgi processes\n" \
281-"\n" \
282-"Options:\n" \
283-" -f <fcgiapp> filename of the fcgi-application\n" \
284-" -a <addr> bind to ip address\n" \
285-" -p <port> bind to tcp-port\n" \
286-" -s <path> bind to unix-domain socket\n" \
287-" -C <childs> (PHP only) numbers of childs to spawn (default 5)\n" \
288-" -F <childs> numbers of childs to fork (default 1)\n" \
289-" -P <path> name of PID-file for spawed process\n" \
290-" -n no fork (for daemontools)\n" \
291-" -v show version\n" \
292-" -h show this help\n" \
293-"(root only)\n" \
294-" -c <dir> chroot to directory\n" \
295-" -u <user> change to user-id\n" \
296-" -g <group> change to group-id\n" \
297-;
298- write(1, b, strlen(b));
299-}
300-
301-
302-int main(int argc, char **argv) {
303- char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
304- *groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
305- *addr = NULL;
306- char **fcgi_app_argv = { NULL };
307- unsigned short port = 0;
308- int child_count = 5;
309- int fork_count = 1;
310- int i_am_root, o;
311- int pid_fd = -1;
312- int nofork = 0;
313- struct sockaddr_un un;
314-
315- i_am_root = (getuid() == 0);
316-
317- while (-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:F:s:P:"))) {
318- switch(o) {
319- case 'f': fcgi_app = optarg; break;
320- case 'a': addr = optarg;/* ip addr */ break;
321- case 'p': port = strtol(optarg, NULL, 10);/* port */ break;
322- case 'C': child_count = strtol(optarg, NULL, 10);/* */ break;
323- case 'F': fork_count = strtol(optarg, NULL, 10);/* */ break;
324- case 's': unixsocket = optarg; /* unix-domain socket */ break;
325- case 'c': if (i_am_root) { changeroot = optarg; }/* chroot() */ break;
326- case 'u': if (i_am_root) { username = optarg; } /* set user */ break;
327- case 'g': if (i_am_root) { groupname = optarg; } /* set group */ break;
328- case 'n': nofork = 1; break;
329- case 'P': pid_file = optarg; /* PID file */ break;
330- case 'v': show_version(); return 0;
331- case 'h': show_help(); return 0;
332- default:
333- show_help();
334- return -1;
335- }
336- }
337-
338- if (optind < argc) {
339- fcgi_app_argv = &argv[optind];
340- }
341-
342- if ((fcgi_app == NULL && fcgi_app_argv == NULL) || (port == 0 && unixsocket == NULL)) {
343- show_help();
344- return -1;
345- }
346-
347- if (unixsocket && port) {
348- fprintf(stderr, "%s.%d: %s\n",
349- __FILE__, __LINE__,
350- "either a unix domain socket or a tcp-port, but not both\n");
351-
352- return -1;
353- }
354-
355- if (unixsocket && strlen(unixsocket) > sizeof(un.sun_path) - 1) {
356- fprintf(stderr, "%s.%d: %s\n",
357- __FILE__, __LINE__,
358- "path of the unix socket is too long\n");
359-
360- return -1;
361- }
362-
363- /* UID handling */
364- if (!i_am_root && (geteuid() == 0 || getegid() == 0)) {
365- /* we are setuid-root */
366-
367- fprintf(stderr, "%s.%d: %s\n",
368- __FILE__, __LINE__,
369- "Are you nuts ? Don't apply a SUID bit to this binary\n");
370-
371- return -1;
372- }
373-
374- if (pid_file &&
375- (-1 == (pid_fd = open(pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)))) {
376- struct stat st;
377- if (errno != EEXIST) {
378- fprintf(stderr, "%s.%d: opening pid-file '%s' failed: %s\n",
379- __FILE__, __LINE__,
380- pid_file, strerror(errno));
381-
382- return -1;
383- }
384-
385- /* ok, file exists */
386-
387- if (0 != stat(pid_file, &st)) {
388- fprintf(stderr, "%s.%d: stating pid-file '%s' failed: %s\n",
389- __FILE__, __LINE__,
390- pid_file, strerror(errno));
391-
392- return -1;
393- }
394-
395- /* is it a regular file ? */
396-
397- if (!S_ISREG(st.st_mode)) {
398- fprintf(stderr, "%s.%d: pid-file exists and isn't regular file: '%s'\n",
399- __FILE__, __LINE__,
400- pid_file);
401-
402- return -1;
403- }
404-
405- if (-1 == (pid_fd = open(pid_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) {
406- fprintf(stderr, "%s.%d: opening pid-file '%s' failed: %s\n",
407- __FILE__, __LINE__,
408- pid_file, strerror(errno));
409-
410- return -1;
411- }
412- }
413-
414- if (i_am_root) {
415- struct group *grp = NULL;
416- struct passwd *pwd = NULL;
417-
418- /* set user and group */
419-
420- if (username) {
421- if (NULL == (pwd = getpwnam(username))) {
422- fprintf(stderr, "%s.%d: %s, %s\n",
423- __FILE__, __LINE__,
424- "can't find username", username);
425- return -1;
426- }
427-
428- if (pwd->pw_uid == 0) {
429- fprintf(stderr, "%s.%d: %s\n",
430- __FILE__, __LINE__,
431- "I will not set uid to 0\n");
432- return -1;
433- }
434- }
435-
436- if (groupname) {
437- if (NULL == (grp = getgrnam(groupname))) {
438- fprintf(stderr, "%s.%d: %s %s\n",
439- __FILE__, __LINE__,
440- "can't find groupname",
441- groupname);
442- return -1;
443- }
444- if (grp->gr_gid == 0) {
445- fprintf(stderr, "%s.%d: %s\n",
446- __FILE__, __LINE__,
447- "I will not set gid to 0\n");
448- return -1;
449- }
450-
451- /* do the change before we do the chroot() */
452- setgid(grp->gr_gid);
453- setgroups(0, NULL);
454-
455- if (username) {
456- initgroups(username, grp->gr_gid);
457- }
458-
459- }
460-
461- if (changeroot) {
462- if (-1 == chroot(changeroot)) {
463- fprintf(stderr, "%s.%d: %s %s\n",
464- __FILE__, __LINE__,
465- "chroot failed: ", strerror(errno));
466- return -1;
467- }
468- if (-1 == chdir("/")) {
469- fprintf(stderr, "%s.%d: %s %s\n",
470- __FILE__, __LINE__,
471- "chdir failed: ", strerror(errno));
472- return -1;
473- }
474- }
475-
476- /* drop root privs */
477- if (username) {
478- setuid(pwd->pw_uid);
479- }
480- }
481-
482- return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, fork_count, child_count, pid_fd, nofork);
483-}
484-#else
485-int main() {
486- return -1;
487-}
488-#endif
cdac2405
ER
489Index: src/configfile-glue.c
490===================================================================
b57f094a
ER
491--- src/configfile-glue.c (.../tags/lighttpd-1.4.22) (revision 2504)
492+++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
493@@ -49,7 +49,7 @@
494 buffer_copy_string_buffer(ds->value, ((data_string *)(da->value->data[j]))->value);
495 if (!da->is_index_key) {
496 /* the id's were generated automaticly, as we copy now we might have to renumber them
497- * this is used to prepend server.modules by mod_indexfiles as it has to be loaded
498+ * this is used to prepend server.modules by mod_indexfile as it has to be loaded
499 * before mod_fastcgi and friends */
500 buffer_copy_string_buffer(ds->key, ((data_string *)(da->value->data[j]))->key);
501 }
cdac2405
ER
502@@ -181,7 +181,7 @@
503 return config_insert_values_internal(srv, ca, cv);
504 }
505
506-unsigned short sock_addr_get_port(sock_addr *addr) {
507+static unsigned short sock_addr_get_port(sock_addr *addr) {
508 #ifdef HAVE_IPV6
509 return ntohs(addr->plain.sa_family ? addr->ipv6.sin6_port : addr->ipv4.sin_port);
510 #else
511Index: src/mod_cgi.c
512===================================================================
b57f094a
ER
513--- src/mod_cgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
514+++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
515@@ -24,6 +24,7 @@
516 #include <fcntl.h>
517
518 #include "server.h"
519+#include "stat_cache.h"
520 #include "keyvalue.h"
521 #include "log.h"
522 #include "connections.h"
523@@ -36,6 +37,8 @@
524 # include <sys/filio.h>
525 #endif
526
527+#include "version.h"
528+
529 enum {EOL_UNSET, EOL_N, EOL_RN};
530
531 typedef struct {
b57f094a
ER
532@@ -696,11 +699,11 @@
533
534 if (!key || !val) return -1;
535
536- dst = malloc(key_len + val_len + 3);
537+ dst = malloc(key_len + val_len + 2);
538 memcpy(dst, key, key_len);
539 dst[key_len] = '=';
540- /* add the \0 from the value */
541- memcpy(dst + key_len + 1, val, val_len + 1);
542+ memcpy(dst + key_len + 1, val, val_len);
543+ dst[key_len + 1 + val_len] = '\0';
544
545 if (env->size == 0) {
546 env->size = 16;
9ab53fe1
ER
547@@ -776,25 +779,23 @@
548 /* not needed */
549 close(to_cgi_fds[1]);
550
551- /* HACK:
552- * this is not nice, but it works
553- *
554- * we feed the stderr of the CGI to our errorlog, if possible
555- */
556- if (srv->errorlog_mode == ERRORLOG_FILE) {
557- close(STDERR_FILENO);
558- dup2(srv->errorlog_fd, STDERR_FILENO);
559- }
560-
561 /* create environment */
562 env.ptr = NULL;
563 env.size = 0;
564 env.used = 0;
565
566- cgi_env_add(&env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION));
567+ if (buffer_is_empty(con->conf.server_tag)) {
568+ cgi_env_add(&env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_DESC));
569+ } else {
570+ cgi_env_add(&env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag));
571+ }
572
573 if (!buffer_is_empty(con->server_name)) {
574- cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name));
575+ size_t len = con->server_name->used - 1;
576+ char *colon = strchr(con->server_name->ptr, ':');
577+ if (colon) len = colon - con->server_name->ptr;
578+
579+ cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
580 } else {
581 #ifdef HAVE_IPV6
582 s = inet_ntop(srv_sock->addr.plain.sa_family,
b57f094a
ER
583@@ -972,9 +973,15 @@
584 buffer_prepare_append(p->tmp_buf, ds->key->used + 2);
585
586 for (j = 0; j < ds->key->used - 1; j++) {
587- p->tmp_buf->ptr[p->tmp_buf->used++] =
588- light_isalnum((unsigned char)ds->key->ptr[j]) ?
589- toupper((unsigned char)ds->key->ptr[j]) : '_';
590+ char cr = '_';
591+ if (light_isalpha(ds->key->ptr[j])) {
592+ /* upper-case */
593+ cr = ds->key->ptr[j] & ~32;
594+ } else if (light_isdigit(ds->key->ptr[j])) {
595+ /* copy */
596+ cr = ds->key->ptr[j];
597+ }
598+ p->tmp_buf->ptr[p->tmp_buf->used++] = cr;
599 }
600 p->tmp_buf->ptr[p->tmp_buf->used++] = '\0';
601
602@@ -1203,6 +1210,7 @@
9ab53fe1
ER
603 size_t k, s_len;
604 plugin_data *p = p_d;
605 buffer *fn = con->physical.path;
606+ stat_cache_entry *sce = NULL;
607
608 if (con->mode != DIRECT) return HANDLER_GO_ON;
609
b57f094a 610@@ -1210,6 +1218,9 @@
9ab53fe1
ER
611
612 mod_cgi_patch_connection(srv, con, p);
613
614+ if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) return HANDLER_GO_ON;
615+ if (!S_ISREG(sce->st.st_mode)) return HANDLER_GO_ON;
616+
617 s_len = fn->used - 1;
618
619 for (k = 0; k < p->conf.cgi->used; k++) {
b57f094a 620@@ -1369,6 +1380,7 @@
cdac2405
ER
621 }
622
623
624+int mod_cgi_plugin_init(plugin *p);
625 int mod_cgi_plugin_init(plugin *p) {
626 p->version = LIGHTTPD_VERSION_ID;
627 p->name = buffer_init_string("cgi");
628Index: src/mod_cml.c
629===================================================================
b57f094a
ER
630--- src/mod_cml.c (.../tags/lighttpd-1.4.22) (revision 2504)
631+++ src/mod_cml.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
632@@ -178,7 +178,7 @@
633 }
634 #undef PATCH
635
636-int cache_call_lua(server *srv, connection *con, plugin_data *p, buffer *cml_file) {
637+static int cache_call_lua(server *srv, connection *con, plugin_data *p, buffer *cml_file) {
638 buffer *b;
639 char *c;
640
641@@ -305,6 +305,7 @@
642 }
643 }
644
645+int mod_cml_plugin_init(plugin *p);
646 int mod_cml_plugin_init(plugin *p) {
647 p->version = LIGHTTPD_VERSION_ID;
648 p->name = buffer_init_string("cache");
649Index: src/mod_secure_download.c
650===================================================================
b57f094a
ER
651--- src/mod_secure_download.c (.../tags/lighttpd-1.4.22) (revision 2504)
652+++ src/mod_secure_download.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
653@@ -138,7 +138,7 @@
654 * @return if the supplied string is a valid MD5 string 1 is returned otherwise 0
655 */
656
657-int is_hex_len(const char *str, size_t len) {
658+static int is_hex_len(const char *str, size_t len) {
659 size_t i;
660
661 if (NULL == str) return 0;
662@@ -293,6 +293,7 @@
663
664 /* this function is called at dlopen() time and inits the callbacks */
665
666+int mod_secdownload_plugin_init(plugin *p);
667 int mod_secdownload_plugin_init(plugin *p) {
668 p->version = LIGHTTPD_VERSION_ID;
669 p->name = buffer_init_string("secdownload");
9ab53fe1
ER
670Index: src/base.h
671===================================================================
b57f094a
ER
672--- src/base.h (.../tags/lighttpd-1.4.22) (revision 2504)
673+++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
674@@ -183,11 +183,15 @@
675 } response;
676
677 typedef struct {
678- buffer *scheme;
679+ buffer *scheme; /* scheme without colon or slashes ( "http" or "https" ) */
680+
681+ /* authority with optional portnumber ("site.name" or "site.name:8080" ) NOTE: without "username:password@" */
682 buffer *authority;
683+
684+ /* path including leading slash ("/" or "/index.html") - urldecoded, and sanitized ( buffer_path_simplify() && buffer_urldecode_path() ) */
685 buffer *path;
686- buffer *path_raw;
687- buffer *query;
688+ buffer *path_raw; /* raw path, as sent from client. no urldecoding or path simplifying */
689+ buffer *query; /* querystring ( everything after "?", ie: in "/index.php?foo=1", query is "foo=1" ) */
690 } request_uri;
691
692 typedef struct {
b57f094a
ER
693@@ -270,6 +274,7 @@
694 unsigned short ssl_use_sslv2;
695
696 unsigned short use_ipv6;
697+ unsigned short defer_accept;
698 unsigned short is_ssl;
699 unsigned short allow_http11;
700 unsigned short etag_use_inode;
701@@ -533,7 +538,7 @@
9ab53fe1
ER
702
703 /* the errorlog */
704 int errorlog_fd;
705- enum { ERRORLOG_STDERR, ERRORLOG_FILE, ERRORLOG_SYSLOG } errorlog_mode;
706+ enum { ERRORLOG_STDERR, ERRORLOG_FILE, ERRORLOG_SYSLOG, ERRORLOG_PIPE } errorlog_mode;
707 buffer *errorlog_buf;
708
709 fdevents *ev, *ev_ins;
cdac2405
ER
710Index: src/mod_rewrite.c
711===================================================================
b57f094a
ER
712--- src/mod_rewrite.c (.../tags/lighttpd-1.4.22) (revision 2504)
713+++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
714@@ -63,7 +63,7 @@
715 free(hctx);
716 }
717
718-rewrite_rule_buffer *rewrite_rule_buffer_init(void) {
719+static rewrite_rule_buffer *rewrite_rule_buffer_init(void) {
720 rewrite_rule_buffer *kvb;
721
722 kvb = calloc(1, sizeof(*kvb));
723@@ -71,7 +71,7 @@
724 return kvb;
725 }
726
727-int rewrite_rule_buffer_append(rewrite_rule_buffer *kvb, buffer *key, buffer *value, int once) {
728+static int rewrite_rule_buffer_append(rewrite_rule_buffer *kvb, buffer *key, buffer *value, int once) {
729 #ifdef HAVE_PCRE_H
730 size_t i;
731 const char *errptr;
732@@ -121,7 +121,7 @@
733 #endif
734 }
735
736-void rewrite_rule_buffer_free(rewrite_rule_buffer *kvb) {
737+static void rewrite_rule_buffer_free(rewrite_rule_buffer *kvb) {
738 #ifdef HAVE_PCRE_H
739 size_t i;
740
741@@ -444,6 +444,7 @@
742 return HANDLER_GO_ON;
743 }
744
745+int mod_rewrite_plugin_init(plugin *p);
746 int mod_rewrite_plugin_init(plugin *p) {
747 p->version = LIGHTTPD_VERSION_ID;
748 p->name = buffer_init_string("rewrite");
749Index: src/connections.c
750===================================================================
b57f094a
ER
751--- src/connections.c (.../tags/lighttpd-1.4.22) (revision 2504)
752+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2504)
753@@ -192,7 +192,7 @@
754
755 static int connection_handle_read_ssl(server *srv, connection *con) {
756 #ifdef USE_OPENSSL
757- int r, ssl_err, len;
758+ int r, ssl_err, len, count = 0;
759 buffer *b = NULL;
760
761 if (!con->conf.is_ssl) return -1;
762@@ -221,10 +221,11 @@
763 /* we move the buffer to the chunk-queue, no need to free it */
764
765 chunkqueue_append_buffer_weak(con->read_queue, b);
766+ count += len;
767 con->bytes_read += len;
768 b = NULL;
769 }
770- } while (len > 0);
771+ } while (len > 0 && count < MAX_READ_LIMIT);
772
773
774 if (len < 0) {
775@@ -334,6 +335,7 @@
776 b = chunkqueue_get_append_buffer(con->read_queue);
777 buffer_prepare_copy(b, 4 * 1024);
778 } else {
779+ if (toread > MAX_READ_LIMIT) toread = MAX_READ_LIMIT;
780 b = chunkqueue_get_append_buffer(con->read_queue);
781 buffer_prepare_copy(b, toread + 1);
782 }
783@@ -858,7 +860,7 @@
cdac2405
ER
784 *
785 * we get called by the state-engine and by the fdevent-handler
786 */
787-int connection_handle_read_state(server *srv, connection *con) {
788+static int connection_handle_read_state(server *srv, connection *con) {
789 connection_state_t ostate = con->state;
790 chunk *c, *last_chunk;
791 off_t last_offset;
b57f094a 792@@ -1156,7 +1158,7 @@
cdac2405
ER
793 return 0;
794 }
795
796-handler_t connection_handle_fdevent(void *s, void *context, int revents) {
797+static handler_t connection_handle_fdevent(void *s, void *context, int revents) {
798 server *srv = (server *)s;
799 connection *con = context;
800
801Index: src/mod_staticfile.c
802===================================================================
b57f094a
ER
803--- src/mod_staticfile.c (.../tags/lighttpd-1.4.22) (revision 2504)
804+++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
805@@ -532,6 +532,7 @@
806
807 /* this function is called at dlopen() time and inits the callbacks */
808
809+int mod_staticfile_plugin_init(plugin *p);
810 int mod_staticfile_plugin_init(plugin *p) {
811 p->version = LIGHTTPD_VERSION_ID;
812 p->name = buffer_init_string("staticfile");
813Index: src/mod_alias.c
814===================================================================
b57f094a
ER
815--- src/mod_alias.c (.../tags/lighttpd-1.4.22) (revision 2504)
816+++ src/mod_alias.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
817@@ -187,6 +187,7 @@
818
819 /* this function is called at dlopen() time and inits the callbacks */
820
821+int mod_alias_plugin_init(plugin *p);
822 int mod_alias_plugin_init(plugin *p) {
823 p->version = LIGHTTPD_VERSION_ID;
824 p->name = buffer_init_string("alias");
825Index: src/network.c
826===================================================================
b57f094a
ER
827--- src/network.c (.../tags/lighttpd-1.4.22) (revision 2504)
828+++ src/network.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
829@@ -26,7 +26,7 @@
830 # include <openssl/rand.h>
831 #endif
832
833-handler_t network_server_handle_fdevent(void *s, void *context, int revents) {
834+static handler_t network_server_handle_fdevent(void *s, void *context, int revents) {
835 server *srv = (server *)s;
836 server_socket *srv_socket = (server_socket *)context;
837 connection *con;
838@@ -62,7 +62,7 @@
839 return HANDLER_GO_ON;
840 }
841
842-int network_server_init(server *srv, buffer *host_token, specific_config *s) {
843+static int network_server_init(server *srv, buffer *host_token, specific_config *s) {
844 int val;
845 socklen_t addr_len;
846 server_socket *srv_socket;
b57f094a
ER
847@@ -73,10 +73,6 @@
848 int is_unix_domain_socket = 0;
849 int fd;
850
851-#ifdef SO_ACCEPTFILTER
852- struct accept_filter_arg afa;
853-#endif
854-
855 #ifdef __WIN32
856 WORD wVersionRequested;
857 WSADATA wsaData;
858@@ -396,12 +392,17 @@
859
860 return -1;
861 #endif
862+#ifdef TCP_DEFER_ACCEPT
863+ } else if (s->defer_accept) {
864+ int v = s->defer_accept;
865+ if (-1 == setsockopt(srv_socket->fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &v, sizeof(v))) {
866+ log_error_write(srv, __FILE__, __LINE__, "ss", "can't set TCP_DEFER_ACCEPT: ", strerror(errno));
867+ }
868+#endif
869 } else {
870 #ifdef SO_ACCEPTFILTER
871- /*
872- * FreeBSD accf_http filter
873- *
874- */
875+ /* FreeBSD accf_http filter */
876+ struct accept_filter_arg afa;
877 memset(&afa, 0, sizeof(afa));
878 strcpy(afa.af_name, "httpready");
879 if (setsockopt(srv_socket->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)) < 0) {
880Index: src/configfile.c
881===================================================================
882--- src/configfile.c (.../tags/lighttpd-1.4.22) (revision 2504)
883+++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 2504)
884@@ -96,6 +96,7 @@
885 { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
886 { "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */
887 { "debug.log-timeouts", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 53 */
888+ { "server.defer-accept", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 54 */
889 { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
890 { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
891 { "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
892@@ -164,6 +165,7 @@
893 s->is_ssl = 0;
894 s->ssl_use_sslv2 = 0;
895 s->use_ipv6 = 0;
896+ s->defer_accept = 0;
897 #ifdef HAVE_LSTAT
898 s->follow_symlink = 1;
899 #endif
900@@ -182,6 +184,7 @@
901
902 cv[7].destination = s->server_tag;
903 cv[8].destination = &(s->use_ipv6);
904+ cv[54].destination = &(s->defer_accept);
905
906
907 /* 13 max-worker */
cdac2405
ER
908Index: src/mod_trigger_b4_dl.c
909===================================================================
b57f094a
ER
910--- src/mod_trigger_b4_dl.c (.../tags/lighttpd-1.4.22) (revision 2504)
911+++ src/mod_trigger_b4_dl.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
912@@ -576,6 +576,7 @@
913
914 /* this function is called at dlopen() time and inits the callbacks */
915
916+int mod_trigger_b4_dl_plugin_init(plugin *p);
917 int mod_trigger_b4_dl_plugin_init(plugin *p) {
918 p->version = LIGHTTPD_VERSION_ID;
919 p->name = buffer_init_string("trigger_b4_dl");
920Index: src/mod_evhost.c
921===================================================================
b57f094a
ER
922--- src/mod_evhost.c (.../tags/lighttpd-1.4.22) (revision 2504)
923+++ src/mod_evhost.c (.../branches/lighttpd-1.4.x) (revision 2504)
924@@ -115,6 +115,7 @@
925 * # %2 => domain name without tld
926 * # %3 => subdomain 1 name
927 * # %4 => subdomain 2 name
928+ * # %_ => fqdn (without port info)
929 * #
930 * evhost.path-pattern = "/home/ckruse/dev/www/%3/htdocs/"
931 *
932@@ -154,11 +155,12 @@
933 }
934
935 /**
936- * assign the different parts of the domain to array-indezes
937- * - %0 - full hostname (authority w/o port)
938+ * assign the different parts of the domain to array-indezes (sub2.sub1.domain.tld)
939+ * - %0 - domain.tld
940 * - %1 - tld
941- * - %2 - domain.tld
942- * - %3 -
943+ * - %2 - domain
944+ * - %3 - sub1
945+ * - ...
946 */
947
948 static int mod_evhost_parse_host(connection *con,array *host) {
949@@ -287,6 +289,16 @@
950 if (*(ptr+1) == '%') {
951 /* %% */
952 buffer_append_string_len(p->tmp_buf,CONST_STR_LEN("%"));
953+ } else if (*(ptr+1) == '_' ) {
954+ /* %_ == full hostname */
955+ char *colon = strchr(con->uri.authority->ptr, ':');
956+
957+ if(colon == NULL) {
958+ buffer_append_string_buffer(p->tmp_buf, con->uri.authority); // adds fqdn
959+ } else {
960+ /* strip the port out of the authority-part of the URI scheme */
961+ buffer_append_string_len(p->tmp_buf, con->uri.authority->ptr, colon - con->uri.authority->ptr); // adds fqdn
962+ }
963 } else if (NULL != (ds = (data_string *)array_get_element(parsed_host,p->conf.path_pieces[i]->ptr))) {
964 if (ds->value->used) {
965 buffer_append_string_buffer(p->tmp_buf,ds->value);
966@@ -318,6 +330,7 @@
cdac2405
ER
967 return HANDLER_GO_ON;
968 }
969
970+int mod_evhost_plugin_init(plugin *p);
971 int mod_evhost_plugin_init(plugin *p) {
972 p->version = LIGHTTPD_VERSION_ID;
973 p->name = buffer_init_string("evhost");
974Index: src/splaytree.c
975===================================================================
b57f094a
ER
976--- src/splaytree.c (.../tags/lighttpd-1.4.22) (revision 2504)
977+++ src/splaytree.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
978@@ -187,7 +187,8 @@
979 }
980 }
981
982-splay_tree *find_rank(int r, splay_tree *t) {
983+#if 0
984+static splay_tree *find_rank(int r, splay_tree *t) {
985 /* Returns a pointer to the node in the tree with the given rank. */
986 /* Returns NULL if there is no such node. */
987 /* Does not change the tree. To guarantee logarithmic behavior, */
988@@ -206,5 +207,4 @@
989 }
990 }
991 }
992-
993-
994+#endif
b57f094a
ER
995Index: src/lemon.c
996===================================================================
997--- src/lemon.c (.../tags/lighttpd-1.4.22) (revision 2504)
998+++ src/lemon.c (.../branches/lighttpd-1.4.x) (revision 2504)
999@@ -31,6 +31,7 @@
1000 extern void free();
1001 extern int access();
1002 extern int atoi();
1003+extern char *getenv();
1004
1005 #ifndef __WIN32__
1006 # if defined(_WIN32) || defined(WIN32)
1007@@ -39,7 +40,7 @@
1008 #endif
1009
1010 /* #define PRIVATE static */
1011-#define PRIVATE
1012+#define PRIVATE static
1013
1014 #ifdef TEST
1015 #define MAXRHS 5 /* Set low to exercise exception code */
1016@@ -50,6 +51,8 @@
1017 char *msort();
1018 extern void *malloc();
1019
1020+extern void memory_error();
1021+
1022 /******** From the file "action.h" *************************************/
1023 struct action *Action_new();
1024 struct action *Action_sort();
1025@@ -291,7 +294,6 @@
1026 };
1027
1028 #define MemoryCheck(X) if((X)==0){ \
1029- extern void memory_error(); \
1030 memory_error(); \
1031 }
1032
1033@@ -445,14 +447,16 @@
1034 #define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead)
1035
1036 /* Free all memory associated with the given acttab */
1037-void acttab_free(acttab *p){
1038+/*
1039+PRIVATE void acttab_free(acttab *p){
1040 free( p->aAction );
1041 free( p->aLookahead );
1042 free( p );
1043 }
1044+*/
1045
1046 /* Allocate a new acttab structure */
1047-acttab *acttab_alloc(void){
1048+PRIVATE acttab *acttab_alloc(void){
1049 acttab *p = malloc( sizeof(*p) );
1050 if( p==0 ){
1051 fprintf(stderr,"Unable to allocate memory for a new acttab.");
1052@@ -464,7 +468,7 @@
1053
1054 /* Add a new action to the current transaction set
1055 */
1056-void acttab_action(acttab *p, int lookahead, int action){
1057+PRIVATE void acttab_action(acttab *p, int lookahead, int action){
1058 if( p->nLookahead>=p->nLookaheadAlloc ){
1059 p->nLookaheadAlloc += 25;
1060 p->aLookahead = realloc( p->aLookahead,
1061@@ -497,7 +501,7 @@
1062 **
1063 ** Return the offset into the action table of the new transaction.
1064 */
1065-int acttab_insert(acttab *p){
1066+PRIVATE int acttab_insert(acttab *p){
1067 int i, j, k, n;
1068 assert( p->nLookahead>0 );
1069
1070@@ -2603,7 +2607,7 @@
1071 }
1072 }
1073
1074-void ConfigPrint(fp,cfp)
1075+PRIVATE void ConfigPrint(fp,cfp)
1076 FILE *fp;
1077 struct config *cfp;
1078 {
1079@@ -2640,7 +2644,7 @@
1080 }
1081
1082 /* Print a plink chain */
1083-PRIVATE void PlinkPrint(out,plp,tag)
1084+void PlinkPrint(out,plp,tag)
1085 FILE *out;
1086 struct plink *plp;
1087 char *tag;
1088@@ -2657,7 +2661,7 @@
1089 /* Print an action to the given file descriptor. Return FALSE if
1090 ** nothing was actually printed.
1091 */
1092-int PrintAction(struct action *ap, FILE *fp, int indent){
1093+PRIVATE int PrintAction(struct action *ap, FILE *fp, int indent){
1094 int result = 1;
1095 switch( ap->type ){
1096 case SHIFT:
1097@@ -2731,6 +2735,7 @@
1098 return;
1099 }
1100
1101+ extern int access();
1102 /* Search for the file "name" which is in the same directory as
1103 ** the exacutable */
1104 PRIVATE char *pathsearch(argv0,name,modemask)
1105@@ -2741,7 +2746,6 @@
1106 char *pathlist;
1107 char *path,*cp;
1108 char c;
1109- extern int access();
1110
1111 #ifdef __WIN32__
1112 cp = strrchr(argv0,'\\');
1113@@ -2755,7 +2759,6 @@
1114 if( path ) sprintf(path,"%s/%s",argv0,name);
1115 *cp = c;
1116 }else{
1117- extern char *getenv();
1118 pathlist = getenv("PATH");
1119 if( pathlist==0 ) pathlist = ".:/bin:/usr/bin";
1120 path = (char *)malloc( strlen(pathlist)+strlen(name)+2 );
1121@@ -2894,7 +2897,7 @@
1122 ** The following routine emits code for the destructor for the
1123 ** symbol sp
1124 */
1125-void emit_destructor_code(out,sp,lemp,lineno)
1126+PRIVATE void emit_destructor_code(out,sp,lemp,lineno)
1127 FILE *out;
1128 struct symbol *sp;
1129 struct lemon *lemp;
1130@@ -2932,7 +2935,7 @@
1131 /*
1132 ** Return TRUE (non-zero) if the given symbol has a destructor.
1133 */
1134-int has_destructor(sp, lemp)
1135+PRIVATE int has_destructor(sp, lemp)
1136 struct symbol *sp;
1137 struct lemon *lemp;
1138 {
1139@@ -3033,7 +3036,7 @@
1140 ** union, also set the ".dtnum" field of every terminal and nonterminal
1141 ** symbol.
1142 */
1143-void print_stack_union(out,lemp,plineno,mhflag)
1144+PRIVATE void print_stack_union(out,lemp,plineno,mhflag)
1145 FILE *out; /* The output stream */
1146 struct lemon *lemp; /* The main info structure for this parser */
1147 int *plineno; /* Pointer to the line number */
1148@@ -3684,7 +3687,6 @@
1149 int i;
1150 s = (char*)malloc( global_size );
1151 if( s==0 ){
1152- extern void memory_error();
1153 memory_error();
1154 }
1155 for(i=0; i<global_size; i++) s[i] = 0;
9ab53fe1
ER
1156Index: src/chunk.h
1157===================================================================
b57f094a
ER
1158--- src/chunk.h (.../tags/lighttpd-1.4.22) (revision 2504)
1159+++ src/chunk.h (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1160@@ -3,6 +3,7 @@
1161
1162 #include "buffer.h"
1163 #include "array.h"
1164+#include "sys-mmap.h"
1165
1166 typedef struct chunk {
1167 enum { UNUSED_CHUNK, MEM_CHUNK, FILE_CHUNK } type;
1168Index: src/etag.c
1169===================================================================
b57f094a
ER
1170--- src/etag.c (.../tags/lighttpd-1.4.22) (revision 2504)
1171+++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1172@@ -44,7 +44,7 @@
1173 size_t i;
1174 uint32_t h;
1175
1176- for (h=0, i=0; i < etag->used; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]);
1177+ for (h=0, i=0; i < etag->used-1; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]);
1178
1179 buffer_reset(mut);
1180 buffer_copy_string_len(mut, CONST_STR_LEN("\""));
cdac2405
ER
1181Index: src/mod_scgi.c
1182===================================================================
b57f094a
ER
1183--- src/mod_scgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
1184+++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1185@@ -38,6 +38,8 @@
1186 #include <sys/wait.h>
1187 #endif
1188
1189+#include "version.h"
1190+
1191 enum {EOL_UNSET, EOL_N, EOL_RN};
1192
1193 /*
1194@@ -372,7 +374,7 @@
cdac2405
ER
1195 free(hctx);
1196 }
1197
1198-scgi_proc *scgi_process_init() {
1199+static scgi_proc *scgi_process_init() {
1200 scgi_proc *f;
1201
1202 f = calloc(1, sizeof(*f));
9ab53fe1 1203@@ -384,7 +386,7 @@
cdac2405
ER
1204 return f;
1205 }
1206
1207-void scgi_process_free(scgi_proc *f) {
1208+static void scgi_process_free(scgi_proc *f) {
1209 if (!f) return;
1210
1211 scgi_process_free(f->next);
9ab53fe1 1212@@ -394,7 +396,7 @@
cdac2405
ER
1213 free(f);
1214 }
1215
1216-scgi_extension_host *scgi_host_init() {
1217+static scgi_extension_host *scgi_host_init() {
1218 scgi_extension_host *f;
1219
1220 f = calloc(1, sizeof(*f));
9ab53fe1 1221@@ -409,7 +411,7 @@
cdac2405
ER
1222 return f;
1223 }
1224
1225-void scgi_host_free(scgi_extension_host *h) {
1226+static void scgi_host_free(scgi_extension_host *h) {
1227 if (!h) return;
1228
1229 buffer_free(h->host);
9ab53fe1 1230@@ -426,7 +428,7 @@
cdac2405
ER
1231
1232 }
1233
1234-scgi_exts *scgi_extensions_init() {
1235+static scgi_exts *scgi_extensions_init() {
1236 scgi_exts *f;
1237
1238 f = calloc(1, sizeof(*f));
9ab53fe1 1239@@ -434,7 +436,7 @@
cdac2405
ER
1240 return f;
1241 }
1242
1243-void scgi_extensions_free(scgi_exts *f) {
1244+static void scgi_extensions_free(scgi_exts *f) {
1245 size_t i;
1246
1247 if (!f) return;
9ab53fe1 1248@@ -464,7 +466,7 @@
cdac2405
ER
1249 free(f);
1250 }
1251
1252-int scgi_extension_insert(scgi_exts *ext, buffer *key, scgi_extension_host *fh) {
1253+static int scgi_extension_insert(scgi_exts *ext, buffer *key, scgi_extension_host *fh) {
1254 scgi_extension *fe;
1255 size_t i;
1256
9ab53fe1 1257@@ -1178,7 +1180,7 @@
cdac2405
ER
1258 }
1259
1260
1261-void scgi_connection_cleanup(server *srv, handler_ctx *hctx) {
1262+static void scgi_connection_cleanup(server *srv, handler_ctx *hctx) {
1263 plugin_data *p;
1264 connection *con;
1265
b57f094a
ER
1266@@ -1281,10 +1283,11 @@
1267
1268 buffer_prepare_append(env, len);
1269
1270- /* include the NUL */
1271- memcpy(env->ptr + env->used, key, key_len + 1);
1272+ memcpy(env->ptr + env->used, key, key_len);
1273+ env->ptr[env->used + key_len] = '\0';
1274 env->used += key_len + 1;
1275- memcpy(env->ptr + env->used, val, val_len + 1);
1276+ memcpy(env->ptr + env->used, val, val_len);
1277+ env->ptr[env->used + val_len] = '\0';
1278 env->used += val_len + 1;
1279
1280 return 0;
1281@@ -1461,10 +1464,18 @@
9ab53fe1
ER
1282 scgi_env_add(p->scgi_env, CONST_STR_LEN("SCGI"), CONST_STR_LEN("1"));
1283
1284
1285- scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION));
1286+ if (buffer_is_empty(con->conf.server_tag)) {
1287+ scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_DESC));
1288+ } else {
1289+ scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag));
1290+ }
1291
1292 if (con->server_name->used) {
1293- scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name));
1294+ size_t len = con->server_name->used - 1;
1295+ char *colon = strchr(con->server_name->ptr, ':');
1296+ if (colon) len = colon - con->server_name->ptr;
1297+
1298+ scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
1299 } else {
1300 #ifdef HAVE_IPV6
1301 s = inet_ntop(srv_sock->addr.plain.sa_family,
b57f094a 1302@@ -1915,7 +1926,7 @@
cdac2405
ER
1303 }
1304
1305
1306-int scgi_proclist_sort_up(server *srv, scgi_extension_host *host, scgi_proc *proc) {
1307+static int scgi_proclist_sort_up(server *srv, scgi_extension_host *host, scgi_proc *proc) {
1308 scgi_proc *p;
1309
1310 UNUSED(srv);
b57f094a
ER
1311@@ -2827,7 +2838,11 @@
1312 */
1313
1314 /* the rewrite is only done for /prefix/? matches */
1315- if (extension->key->ptr[0] == '/' &&
1316+ if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
1317+ buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
1318+ con->uri.path->used = 1;
1319+ con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1320+ } else if (extension->key->ptr[0] == '/' &&
1321 con->uri.path->used > extension->key->used &&
1322 NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
1323 /* rewrite uri.path and pathinfo */
1324@@ -2836,10 +2851,6 @@
1325
1326 con->uri.path->used -= con->request.pathinfo->used - 1;
1327 con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1328- } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
1329- buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
1330- con->uri.path->used = 1;
1331- con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1332 }
1333 }
1334 } else {
1335@@ -3105,6 +3116,7 @@
cdac2405
ER
1336 }
1337
1338
1339+int mod_scgi_plugin_init(plugin *p);
1340 int mod_scgi_plugin_init(plugin *p) {
1341 p->version = LIGHTTPD_VERSION_ID;
1342 p->name = buffer_init_string("scgi");
1343Index: src/mod_mysql_vhost.c
1344===================================================================
b57f094a
ER
1345--- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.22) (revision 2504)
1346+++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1347@@ -422,6 +422,7 @@
1348 }
1349
1350 /* this function is called at dlopen() time and inits the callbacks */
1351+int mod_mysql_vhost_plugin_init(plugin *p);
1352 int mod_mysql_vhost_plugin_init(plugin *p) {
1353 p->version = LIGHTTPD_VERSION_ID;
1354 p->name = buffer_init_string("mysql_vhost");
1355@@ -437,6 +438,7 @@
1356 }
1357 #else
1358 /* we don't have mysql support, this plugin does nothing */
1359+int mod_mysql_vhost_plugin_init(plugin *p);
1360 int mod_mysql_vhost_plugin_init(plugin *p) {
1361 p->version = LIGHTTPD_VERSION_ID;
1362 p->name = buffer_init_string("mysql_vhost");
1363Index: src/request.c
1364===================================================================
b57f094a
ER
1365--- src/request.c (.../tags/lighttpd-1.4.22) (revision 2504)
1366+++ src/request.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1367@@ -86,10 +86,18 @@
1368 if (host_len == 0) return -1;
1369
1370 /* if the hostname ends in a "." strip it */
1371- if (host->ptr[host_len-1] == '.') host_len -= 1;
1372+ if (host->ptr[host_len-1] == '.') {
1373+ /* shift port info one left */
1374+ if (NULL != colon) memmove(colon-1, colon, host->used - host_len);
1375+ else host->ptr[host_len-1] = '\0';
1376+ host_len -= 1;
1377+ host->used -= 1;
1378+ }
1379
1380+ if (host_len == 0) return -1;
1381+
1382 /* scan from the right and skip the \0 */
1383- for (i = host_len - 1; i + 1 > 0; i--) {
1384+ for (i = host_len; i-- > 0; ) {
1385 const char c = host->ptr[i];
1386
1387 switch (stage) {
1388@@ -200,7 +208,7 @@
cdac2405
ER
1389 #define DUMP_HEADER
1390 #endif
1391
1392-int http_request_split_value(array *vals, buffer *b) {
1393+static int http_request_split_value(array *vals, buffer *b) {
1394 char *s;
1395 size_t i;
1396 int state = 0;
9ab53fe1 1397@@ -262,7 +270,7 @@
cdac2405
ER
1398 return 0;
1399 }
1400
1401-int request_uri_is_valid_char(unsigned char c) {
1402+static int request_uri_is_valid_char(unsigned char c) {
1403 if (c <= 32) return 0;
1404 if (c == 127) return 0;
1405 if (c == 255) return 0;
1406Index: src/mod_magnet_cache.c
1407===================================================================
b57f094a
ER
1408--- src/mod_magnet_cache.c (.../tags/lighttpd-1.4.22) (revision 2504)
1409+++ src/mod_magnet_cache.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1410@@ -9,7 +9,7 @@
1411 #include <lualib.h>
1412 #include <lauxlib.h>
1413
1414-script *script_init() {
1415+static script *script_init() {
1416 script *sc;
1417
1418 sc = calloc(1, sizeof(*sc));
1419@@ -19,7 +19,7 @@
1420 return sc;
1421 }
1422
1423-void script_free(script *sc) {
1424+static void script_free(script *sc) {
1425 if (!sc) return;
1426
1427 lua_pop(sc->L, 1); /* the function copy */
1428Index: src/mod_flv_streaming.c
1429===================================================================
b57f094a
ER
1430--- src/mod_flv_streaming.c (.../tags/lighttpd-1.4.22) (revision 2504)
1431+++ src/mod_flv_streaming.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1432@@ -265,6 +265,7 @@
1433
1434 /* this function is called at dlopen() time and inits the callbacks */
1435
1436+int mod_flv_streaming_plugin_init(plugin *p);
1437 int mod_flv_streaming_plugin_init(plugin *p) {
1438 p->version = LIGHTTPD_VERSION_ID;
1439 p->name = buffer_init_string("flv_streaming");
1440Index: src/mod_rrdtool.c
1441===================================================================
b57f094a
ER
1442--- src/mod_rrdtool.c (.../tags/lighttpd-1.4.22) (revision 2504)
1443+++ src/mod_rrdtool.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1444@@ -91,7 +91,7 @@
1445 return HANDLER_GO_ON;
1446 }
1447
1448-int mod_rrd_create_pipe(server *srv, plugin_data *p) {
1449+static int mod_rrd_create_pipe(server *srv, plugin_data *p) {
1450 #ifdef HAVE_FORK
1451 pid_t pid;
1452
9ab53fe1
ER
1453@@ -230,6 +230,7 @@
1454
1455 static int mod_rrdtool_create_rrd(server *srv, plugin_data *p, plugin_config *s) {
1456 struct stat st;
1457+ int r;
1458
1459 /* check if DB already exists */
1460 if (0 == stat(s->path_rrd->ptr, &st)) {
1461@@ -239,54 +240,57 @@
1462 "not a regular file:", s->path_rrd);
1463 return HANDLER_ERROR;
1464 }
1465- } else {
1466- int r ;
1467- /* create a new one */
1468+ }
1469
1470- buffer_copy_string_len(p->cmd, CONST_STR_LEN("create "));
1471- buffer_append_string_buffer(p->cmd, s->path_rrd);
1472- buffer_append_string_len(p->cmd, CONST_STR_LEN(
1473- " --step 60 "
1474- "DS:InOctets:ABSOLUTE:600:U:U "
1475- "DS:OutOctets:ABSOLUTE:600:U:U "
1476- "DS:Requests:ABSOLUTE:600:U:U "
1477- "RRA:AVERAGE:0.5:1:600 "
1478- "RRA:AVERAGE:0.5:6:700 "
1479- "RRA:AVERAGE:0.5:24:775 "
1480- "RRA:AVERAGE:0.5:288:797 "
1481- "RRA:MAX:0.5:1:600 "
1482- "RRA:MAX:0.5:6:700 "
1483- "RRA:MAX:0.5:24:775 "
1484- "RRA:MAX:0.5:288:797 "
1485- "RRA:MIN:0.5:1:600 "
1486- "RRA:MIN:0.5:6:700 "
1487- "RRA:MIN:0.5:24:775 "
1488- "RRA:MIN:0.5:288:797\n"));
1489+ /* still create DB if it's empty file */
1490+ if (st.st_size > 0) {
1491+ return HANDLER_GO_ON;
1492+ }
1493
1494- if (-1 == (r = safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
1495- log_error_write(srv, __FILE__, __LINE__, "ss",
1496- "rrdtool-write: failed", strerror(errno));
1497+ /* create a new one */
1498+ buffer_copy_string_len(p->cmd, CONST_STR_LEN("create "));
1499+ buffer_append_string_buffer(p->cmd, s->path_rrd);
1500+ buffer_append_string_len(p->cmd, CONST_STR_LEN(
1501+ " --step 60 "
1502+ "DS:InOctets:ABSOLUTE:600:U:U "
1503+ "DS:OutOctets:ABSOLUTE:600:U:U "
1504+ "DS:Requests:ABSOLUTE:600:U:U "
1505+ "RRA:AVERAGE:0.5:1:600 "
1506+ "RRA:AVERAGE:0.5:6:700 "
1507+ "RRA:AVERAGE:0.5:24:775 "
1508+ "RRA:AVERAGE:0.5:288:797 "
1509+ "RRA:MAX:0.5:1:600 "
1510+ "RRA:MAX:0.5:6:700 "
1511+ "RRA:MAX:0.5:24:775 "
1512+ "RRA:MAX:0.5:288:797 "
1513+ "RRA:MIN:0.5:1:600 "
1514+ "RRA:MIN:0.5:6:700 "
1515+ "RRA:MIN:0.5:24:775 "
1516+ "RRA:MIN:0.5:288:797\n"));
1517
1518- return HANDLER_ERROR;
1519- }
1520+ if (-1 == (r = safe_write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
1521+ log_error_write(srv, __FILE__, __LINE__, "ss",
1522+ "rrdtool-write: failed", strerror(errno));
1523
1524- buffer_prepare_copy(p->resp, 4096);
1525- if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) {
1526- log_error_write(srv, __FILE__, __LINE__, "ss",
1527- "rrdtool-read: failed", strerror(errno));
1528+ return HANDLER_ERROR;
1529+ }
1530
1531- return HANDLER_ERROR;
1532- }
1533+ buffer_prepare_copy(p->resp, 4096);
1534+ if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) {
1535+ log_error_write(srv, __FILE__, __LINE__, "ss",
1536+ "rrdtool-read: failed", strerror(errno));
1537
1538- p->resp->used = r;
1539+ return HANDLER_ERROR;
1540+ }
1541
1542- if (p->resp->ptr[0] != 'O' ||
1543- p->resp->ptr[1] != 'K') {
1544- log_error_write(srv, __FILE__, __LINE__, "sbb",
1545- "rrdtool-response:", p->cmd, p->resp);
1546+ p->resp->used = r;
1547
1548- return HANDLER_ERROR;
1549- }
1550+ if (p->resp->ptr[0] != 'O' ||
1551+ p->resp->ptr[1] != 'K') {
1552+ log_error_write(srv, __FILE__, __LINE__, "sbb",
1553+ "rrdtool-response:", p->cmd, p->resp);
1554+
1555+ return HANDLER_ERROR;
1556 }
1557
1558 return HANDLER_GO_ON;
1559@@ -477,6 +481,7 @@
cdac2405
ER
1560 return HANDLER_GO_ON;
1561 }
1562
1563+int mod_rrdtool_plugin_init(plugin *p);
1564 int mod_rrdtool_plugin_init(plugin *p) {
1565 p->version = LIGHTTPD_VERSION_ID;
1566 p->name = buffer_init_string("rrd");
9ab53fe1
ER
1567Index: src/stat_cache.c
1568===================================================================
b57f094a
ER
1569--- src/stat_cache.c (.../tags/lighttpd-1.4.22) (revision 2504)
1570+++ src/stat_cache.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1571@@ -595,29 +595,31 @@
1572 if (S_ISREG(st.st_mode)) {
1573 /* determine mimetype */
1574 buffer_reset(sce->content_type);
1575+#ifdef HAVE_XATTR
1576+ if (con->conf.use_xattr) {
1577+ stat_cache_attr_get(sce->content_type, name->ptr);
1578+ }
1579+#endif
1580+ /* xattr did not set a content-type. ask the config */
1581+ if (buffer_is_empty(sce->content_type)) {
1582+ for (k = 0; k < con->conf.mimetypes->used; k++) {
1583+ data_string *ds = (data_string *)con->conf.mimetypes->data[k];
1584+ buffer *type = ds->key;
1585
1586- for (k = 0; k < con->conf.mimetypes->used; k++) {
1587- data_string *ds = (data_string *)con->conf.mimetypes->data[k];
1588- buffer *type = ds->key;
1589+ if (type->used == 0) continue;
1590
1591- if (type->used == 0) continue;
1592+ /* check if the right side is the same */
1593+ if (type->used > name->used) continue;
1594
1595- /* check if the right side is the same */
1596- if (type->used > name->used) continue;
1597-
1598- if (0 == strncasecmp(name->ptr + name->used - type->used, type->ptr, type->used - 1)) {
1599- buffer_copy_string_buffer(sce->content_type, ds->value);
1600- break;
1601+ if (0 == strncasecmp(name->ptr + name->used - type->used, type->ptr, type->used - 1)) {
1602+ buffer_copy_string_buffer(sce->content_type, ds->value);
1603+ break;
1604+ }
1605 }
1606 }
1607- etag_create(sce->etag, &(sce->st), con->etag_flags);
1608-#ifdef HAVE_XATTR
1609- if (con->conf.use_xattr && buffer_is_empty(sce->content_type)) {
1610- stat_cache_attr_get(sce->content_type, name->ptr);
1611- }
1612-#endif
1613+ etag_create(sce->etag, &(sce->st), con->etag_flags);
1614 } else if (S_ISDIR(st.st_mode)) {
1615- etag_create(sce->etag, &(sce->st), con->etag_flags);
1616+ etag_create(sce->etag, &(sce->st), con->etag_flags);
1617 }
1618
1619 #ifdef HAVE_FAM_H
1620Index: src/response.c
1621===================================================================
b57f094a
ER
1622--- src/response.c (.../tags/lighttpd-1.4.22) (revision 2504)
1623+++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1624@@ -25,6 +25,7 @@
1625 #include "plugin.h"
1626
1627 #include "sys-socket.h"
1628+#include "version.h"
1629
1630 int http_response_write_header(server *srv, connection *con) {
1631 buffer *b;
1632@@ -104,7 +105,7 @@
1633
1634 if (!have_server) {
1635 if (buffer_is_empty(con->conf.server_tag)) {
1636- buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: " PACKAGE_NAME "/" PACKAGE_VERSION));
1637+ buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: " PACKAGE_DESC));
1638 } else if (con->conf.server_tag->used > 1) {
1639 buffer_append_string_len(b, CONST_STR_LEN("\r\nServer: "));
1640 buffer_append_string_encoded(b, CONST_BUF_LEN(con->conf.server_tag), ENCODING_HTTP_HEADER);
1641Index: src/SConscript
1642===================================================================
b57f094a
ER
1643--- src/SConscript (.../tags/lighttpd-1.4.22) (revision 2504)
1644+++ src/SConscript (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
1645@@ -70,7 +70,7 @@
1646 'mod_cml' : {
1647 'src' : [ 'mod_cml_lua.c', 'mod_cml.c', 'mod_cml_funcs.c' ],
1648 'lib' : [ env['LIBPCRE'], env['LIBMEMCACHE'], env['LIBLUA'], env['LIBLUALIB'] ] },
1649- 'mod_uploadprogress' : { 'src' : [ 'mod_uploadprogress.c' ] },
1650+# 'mod_uploadprogress' : { 'src' : [ 'mod_uploadprogress.c' ] },
1651 'mod_evasive' : { 'src' : [ 'mod_evasive.c' ] },
1652 'mod_ssi' : { 'src' : [ 'mod_ssi_exprparser.c', 'mod_ssi_expr.c', 'mod_ssi.c' ], 'lib' : [ env['LIBPCRE'] ] },
1653 'mod_flv_streaming' : { 'src' : [ 'mod_flv_streaming.c' ] },
1654@@ -153,8 +153,6 @@
1655 instbin = env.Program(bin_targets, src, LINKFLAGS = bin_linkflags, LIBS= [ env['LIBS'], common_lib, env['LIBDL'] ])
1656 env.Depends(instbin, configparser)
1657
1658-spawn_fcgi = env.Program("spawn-fcgi", "spawn-fcgi.c")
1659-
1660 if env['COMMON_LIB'] == 'bin':
1661 common_lib = instbin[1]
1662
1663@@ -168,9 +166,6 @@
1664
1665 inst = []
1666
1667-Default(spawn_fcgi)
1668-inst += env.Install('${bindir}', spawn_fcgi)
1669-
1670 if env['build_dynamic']:
1671 Default(instbin[0], instlib)
1672 inst += env.Install('${sbindir}', instbin[0])
cdac2405
ER
1673Index: src/mod_cml_funcs.c
1674===================================================================
b57f094a
ER
1675--- src/mod_cml_funcs.c (.../tags/lighttpd-1.4.22) (revision 2504)
1676+++ src/mod_cml_funcs.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1677@@ -93,7 +93,7 @@
1678 return 1;
1679 }
1680
1681-int f_dir_files_iter(lua_State *L) {
1682+static int f_dir_files_iter(lua_State *L) {
1683 DIR *d;
1684 struct dirent *de;
1685
1686@@ -211,7 +211,7 @@
1687 }
1688
1689 if (NULL == (r = mc_aget(mc,
1690- lua_tostring(L, 1), lua_strlen(L, 1)))) {
1691+ (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) {
1692
1693 lua_pushboolean(L, 0);
1694 return 1;
1695@@ -248,7 +248,7 @@
1696 }
1697
1698 if (NULL == (r = mc_aget(mc,
1699- lua_tostring(L, 1), lua_strlen(L, 1)))) {
1700+ (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) {
1701 lua_pushnil(L);
1702 return 1;
1703 }
1704@@ -285,7 +285,7 @@
1705 }
1706
1707 if (NULL == (r = mc_aget(mc,
1708- lua_tostring(L, 1), lua_strlen(L, 1)))) {
1709+ (char*) lua_tostring(L, 1), lua_strlen(L, 1)))) {
1710 lua_pushnil(L);
1711 return 1;
1712 }
709c1a0b
ER
1713Index: src/mod_simple_vhost.c
1714===================================================================
b57f094a
ER
1715--- src/mod_simple_vhost.c (.../tags/lighttpd-1.4.22) (revision 2504)
1716+++ src/mod_simple_vhost.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1717@@ -270,6 +270,7 @@
1718 }
1719
1720
1721+int mod_simple_vhost_plugin_init(plugin *p);
1722 int mod_simple_vhost_plugin_init(plugin *p) {
1723 p->version = LIGHTTPD_VERSION_ID;
1724 p->name = buffer_init_string("simple_vhost");
1725Index: src/mod_userdir.c
1726===================================================================
b57f094a
ER
1727--- src/mod_userdir.c (.../tags/lighttpd-1.4.22) (revision 2504)
1728+++ src/mod_userdir.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1729@@ -314,6 +314,7 @@
1730
1731 /* this function is called at dlopen() time and inits the callbacks */
1732
1733+int mod_userdir_plugin_init(plugin *p);
1734 int mod_userdir_plugin_init(plugin *p) {
1735 p->version = LIGHTTPD_VERSION_ID;
1736 p->name = buffer_init_string("userdir");
1737Index: src/mod_proxy.c
1738===================================================================
b57f094a
ER
1739--- src/mod_proxy.c (.../tags/lighttpd-1.4.22) (revision 2504)
1740+++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
1741@@ -332,7 +332,7 @@
1742 return HANDLER_GO_ON;
1743 }
1744
1745-void proxy_connection_close(server *srv, handler_ctx *hctx) {
1746+static void proxy_connection_close(server *srv, handler_ctx *hctx) {
1747 plugin_data *p;
1748 connection *con;
1749
b57f094a
ER
1750@@ -356,20 +356,35 @@
1751 static int proxy_establish_connection(server *srv, handler_ctx *hctx) {
1752 struct sockaddr *proxy_addr;
1753 struct sockaddr_in proxy_addr_in;
1754+#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
1755+ struct sockaddr_in6 proxy_addr_in6;
1756+#endif
1757 socklen_t servlen;
1758
1759 plugin_data *p = hctx->plugin_data;
1760 data_proxy *host= hctx->host;
1761 int proxy_fd = hctx->fd;
1762
1763- memset(&proxy_addr, 0, sizeof(proxy_addr));
1764
1765- proxy_addr_in.sin_family = AF_INET;
1766- proxy_addr_in.sin_addr.s_addr = inet_addr(host->host->ptr);
1767- proxy_addr_in.sin_port = htons(host->port);
1768- servlen = sizeof(proxy_addr_in);
1769+#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON)
1770+ if (strstr(host->host->ptr, ":")) {
1771+ memset(&proxy_addr_in6, 0, sizeof(proxy_addr_in6));
1772+ proxy_addr_in6.sin6_family = AF_INET6;
1773+ inet_pton(AF_INET6, host->host->ptr, (char *) &proxy_addr_in6.sin6_addr);
1774+ proxy_addr_in6.sin6_port = htons(host->port);
1775+ servlen = sizeof(proxy_addr_in6);
1776+ proxy_addr = (struct sockaddr *) &proxy_addr_in6;
1777+ } else
1778+#endif
1779+ {
1780+ memset(&proxy_addr_in, 0, sizeof(proxy_addr_in));
1781+ proxy_addr_in.sin_family = AF_INET;
1782+ proxy_addr_in.sin_addr.s_addr = inet_addr(host->host->ptr);
1783+ proxy_addr_in.sin_port = htons(host->port);
1784+ servlen = sizeof(proxy_addr_in);
1785+ proxy_addr = (struct sockaddr *) &proxy_addr_in;
1786+ }
1787
1788- proxy_addr = (struct sockaddr *) &proxy_addr_in;
1789
1790 if (-1 == connect(proxy_fd, proxy_addr, servlen)) {
1791 if (errno == EINPROGRESS || errno == EALREADY) {
1792@@ -395,7 +410,7 @@
cdac2405
ER
1793 return 0;
1794 }
1795
1796-void proxy_set_header(connection *con, const char *key, const char *value) {
1797+static void proxy_set_header(connection *con, const char *key, const char *value) {
1798 data_string *ds_dst;
1799
1800 if (NULL == (ds_dst = (data_string *)array_get_unused_element(con->request.headers, TYPE_STRING))) {
b57f094a 1801@@ -407,7 +422,7 @@
cdac2405
ER
1802 array_insert_unique(con->request.headers, (data_unset *)ds_dst);
1803 }
1804
1805-void proxy_append_header(connection *con, const char *key, const char *value) {
1806+static void proxy_append_header(connection *con, const char *key, const char *value) {
1807 data_string *ds_dst;
1808
1809 if (NULL == (ds_dst = (data_string *)array_get_unused_element(con->request.headers, TYPE_STRING))) {
b57f094a
ER
1810@@ -741,9 +756,16 @@
1811
1812 switch(hctx->state) {
1813 case PROXY_STATE_INIT:
1814- if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) {
1815+ if (strstr(host->host->ptr,":")) {
1816+ if (-1 == (hctx->fd = socket(AF_INET6, SOCK_STREAM, 0))) {
1817 log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
1818 return HANDLER_ERROR;
1819+ }
1820+ } else {
1821+ if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) {
1822+ log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
1823+ return HANDLER_ERROR;
1824+ }
1825 }
1826 hctx->fde_ndx = -1;
1827
1828@@ -1209,7 +1231,7 @@
9ab53fe1
ER
1829
1830 if (ndx >= (int) extension->value->used) {
1831 /* didn't found a higher id, wrap to the start */
1832- for (ndx = 0; ndx < (int) k; ndx++) {
1833+ for (ndx = 0; ndx <= (int) k; ndx++) {
1834 host = (data_proxy *)extension->value->data[ndx];
1835 if (!host->is_disabled) break;
1836 }
b57f094a 1837@@ -1321,6 +1343,7 @@
cdac2405
ER
1838 }
1839
1840
1841+int mod_proxy_plugin_init(plugin *p);
1842 int mod_proxy_plugin_init(plugin *p) {
1843 p->version = LIGHTTPD_VERSION_ID;
1844 p->name = buffer_init_string("proxy");
1845Index: src/mod_extforward.c
1846===================================================================
b57f094a
ER
1847--- src/mod_extforward.c (.../tags/lighttpd-1.4.22) (revision 2504)
1848+++ src/mod_extforward.c (.../branches/lighttpd-1.4.x) (revision 2504)
1849@@ -80,6 +80,7 @@
1850
1851 typedef struct {
1852 array *forwarder;
1853+ array *headers;
1854 } plugin_config;
1855
1856 typedef struct {
1857@@ -135,6 +136,7 @@
1858 if (!s) continue;
1859
1860 array_free(s->forwarder);
1861+ array_free(s->headers);
1862
1863 free(s);
1864 }
1865@@ -154,7 +156,8 @@
1866 size_t i = 0;
1867
1868 config_values_t cv[] = {
1869- { "extforward.forwarder", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
1870+ { "extforward.forwarder", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
1871+ { "extforward.headers", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
1872 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
1873 };
1874
1875@@ -167,8 +170,10 @@
1876
1877 s = calloc(1, sizeof(plugin_config));
1878 s->forwarder = array_init();
1879+ s->headers = array_init();
1880
1881 cv[0].destination = s->forwarder;
1882+ cv[1].destination = s->headers;
1883
1884 p->config_storage[i] = s;
1885
1886@@ -187,6 +192,7 @@
1887 plugin_config *s = p->config_storage[0];
1888
1889 PATCH(forwarder);
1890+ PATCH(headers);
1891
1892 /* skip the first, the global context */
1893 for (i = 1; i < srv->config_context->used; i++) {
1894@@ -202,6 +208,8 @@
1895
1896 if (buffer_is_equal_string(du->key, CONST_STR_LEN("extforward.forwarder"))) {
1897 PATCH(forwarder);
1898+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("extforward.headers"))) {
1899+ PATCH(headers);
1900 }
1901 }
1902 }
1903@@ -294,37 +302,37 @@
cdac2405
ER
1904 return NULL;
1905 }
1906
1907-struct addrinfo *ipstr_to_sockaddr(const char *host)
b57f094a
ER
1908-{
1909- struct addrinfo hints, *res0;
1910- int result;
1911+static struct addrinfo *ipstr_to_sockaddr(const char *host) {
1912+ struct addrinfo hints, *res0;
1913+ int result;
1914
1915- memset(&hints, 0, sizeof(hints));
1916+ memset(&hints, 0, sizeof(hints));
1917 #ifndef AI_NUMERICSERV
1918-/**
1919- * quoting $ man getaddrinfo
1920- *
1921- * NOTES
1922- * AI_ADDRCONFIG, AI_ALL, and AI_V4MAPPED are available since glibc 2.3.3.
1923- * AI_NUMERICSERV is available since glibc 2.3.4.
1924- */
1925+ /**
1926+ * quoting $ man getaddrinfo
1927+ *
1928+ * NOTES
1929+ * AI_ADDRCONFIG, AI_ALL, and AI_V4MAPPED are available since glibc 2.3.3.
1930+ * AI_NUMERICSERV is available since glibc 2.3.4.
1931+ */
1932 #define AI_NUMERICSERV 0
1933 #endif
1934- hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
1935+ hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
1936
1937- result = getaddrinfo(host, NULL, &hints, &res0);
1938- if ( result != 0 )
1939- {
1940- fprintf(stderr,"could not resolve hostname %s because %s\n", host,gai_strerror(result));
1941- if (result == EAI_SYSTEM)
1942- perror("The system error is ");
1943- return NULL;
1944- }
1945- else
1946- if (res0==0)
1947- fprintf(stderr, "Problem in resolving hostname %s: succeeded, but no information returned\n", host);
1948+ result = getaddrinfo(host, NULL, &hints, &res0);
1949
1950- return res0;
1951+ if (result != 0) {
1952+ fprintf(stderr, "could not resolve hostname %s because %s\n", host, gai_strerror(result));
1953+
1954+ if (result == EAI_SYSTEM)
1955+ perror("The system error is ");
1956+
1957+ return NULL;
1958+ } else if (res0 == 0) {
1959+ fprintf(stderr, "Problem in resolving hostname %s: succeeded, but no information returned\n", host);
1960+ }
1961+
1962+ return res0;
1963 }
1964
1965
1966@@ -351,16 +359,26 @@
1967 mod_extforward_patch_connection(srv, con, p);
1968
1969 if (con->conf.log_request_handling) {
1970- log_error_write(srv, __FILE__, __LINE__, "s",
1971- "-- mod_extforward_uri_handler called");
1972+ log_error_write(srv, __FILE__, __LINE__, "s",
1973+ "-- mod_extforward_uri_handler called");
1974 }
1975
1976- if ((NULL == (forwarded = (data_string *) array_get_element(con->request.headers,"X-Forwarded-For")) &&
1977- NULL == (forwarded = (data_string *) array_get_element(con->request.headers, "Forwarded-For")))) {
1978+ if (p->conf.headers->used) {
1979+ data_string *ds;
1980+ size_t k;
1981
1982+ for(k = 0; k < p->conf.headers->used; k++) {
1983+ ds = (data_string *) p->conf.headers->data[k];
1984+ if (NULL != (forwarded = (data_string*) array_get_element(con->request.headers, ds->value->ptr))) break;
1985+ }
1986+ } else {
1987+ forwarded = (data_string *) array_get_element(con->request.headers,"X-Forwarded-For");
1988+ if (NULL == forwarded) forwarded = (data_string *) array_get_element(con->request.headers, "Forwarded-For");
1989+ }
1990+
1991+ if (NULL == forwarded) {
1992 if (con->conf.log_request_handling) {
1993- log_error_write(srv, __FILE__, __LINE__, "s",
1994- "no X-Forwarded-For|Forwarded-For: found, skipping");
1995+ log_error_write(srv, __FILE__, __LINE__, "s", "no forward header found, skipping");
1996 }
1997
1998 return HANDLER_GO_ON;
1999@@ -368,11 +386,10 @@
2000
2001 #ifdef HAVE_IPV6
2002 dst_addr_str = inet_ntop(con->dst_addr.plain.sa_family,
2003- con->dst_addr.plain.sa_family == AF_INET6 ?
2004- (struct sockaddr *)&(con->dst_addr.ipv6.sin6_addr) :
2005- (struct sockaddr *)&(con->dst_addr.ipv4.sin_addr),
2006- b2,
2007- (sizeof b2) - 1);
2008+ con->dst_addr.plain.sa_family == AF_INET6 ?
2009+ (struct sockaddr *)&(con->dst_addr.ipv6.sin6_addr) :
2010+ (struct sockaddr *)&(con->dst_addr.ipv4.sin_addr),
2011+ b2, (sizeof b2) - 1);
2012 #else
2013 dst_addr_str = inet_ntoa(con->dst_addr.ipv4.sin_addr);
2014 #endif
2015@@ -420,6 +437,7 @@
2016 }
2017 }
2018 #else
2019+ UNUSED(addrs_left);
2020 sock.ipv4.sin_addr.s_addr = inet_addr(real_remote_addr);
2021 sock.plain.sa_family = (sock.ipv4.sin_addr.s_addr == 0xFFFFFFFF) ? AF_UNSPEC : AF_INET;
2022 #endif
2023@@ -439,7 +457,7 @@
2024 buffer_copy_string(con->dst_addr_buf, real_remote_addr);
2025
2026 if (con->conf.log_request_handling) {
2027- log_error_write(srv, __FILE__, __LINE__, "ss",
2028+ log_error_write(srv, __FILE__, __LINE__, "ss",
2029 "patching con->dst_addr_buf for the accesslog:", real_remote_addr);
2030 }
2031 /* Now, clean the conf_cond cache, because we may have changed the results of tests */
2032@@ -479,6 +497,7 @@
cdac2405
ER
2033
2034 /* this function is called at dlopen() time and inits the callbacks */
2035
2036+int mod_extforward_plugin_init(plugin *p);
2037 int mod_extforward_plugin_init(plugin *p) {
2038 p->version = LIGHTTPD_VERSION_ID;
2039 p->name = buffer_init_string("extforward");
9ab53fe1
ER
2040Index: src/Makefile.am
2041===================================================================
b57f094a
ER
2042--- src/Makefile.am (.../tags/lighttpd-1.4.22) (revision 2504)
2043+++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2044@@ -2,21 +2,37 @@
2045
2046 noinst_PROGRAMS=proc_open lemon # simple-fcgi #graphic evalo bench ajp ssl error_test adserver gen-license
2047 sbin_PROGRAMS=lighttpd lighttpd-angel
2048-bin_PROGRAMS=spawn-fcgi
2049 LEMON=$(top_builddir)/src/lemon$(EXEEXT)
2050
2051 lemon_SOURCES=lemon.c
2052
2053 lighttpd_angel_SOURCES=lighttpd-angel.c
2054
2055-#simple_fcgi_SOURCES=simple-fcgi.c
2056-#simple_fcgi_LDADD=-lfcgi
2057+.PHONY: versionstamp parsers
2058
2059+all: versionstamp
2060+
2061+versionstamp:
2062+ @test -f versionstamp.h || touch versionstamp.h; \
2063+ REVISION="$$(LANG=C svnversion "$(top_srcdir)" 2>/dev/null || echo exported)"; \
2064+ if test $$REVISION = "exported"; then \
2065+ REVISION="$$(LANG=C cd "$(top_srcdir)"; git describe --always 2>/dev/null)"; \
2066+ fi; \
2067+ if test -n "$$REVISION"; then \
2068+ echo "#define REPO_VERSION \"-devel-$$REVISION\"" > versionstamp.h.tmp; \
2069+ else \
2070+ echo "#define REPO_VERSION \"\"" > versionstamp.h.tmp; \
2071+ fi; \
2072+ if ! diff versionstamp.h.tmp versionstamp.h >/dev/null 2>/dev/null; then \
2073+ mv versionstamp.h.tmp versionstamp.h; \
2074+ else \
2075+ rm versionstamp.h.tmp; \
2076+ fi
2077+
2078 if CROSS_COMPILING
2079 configparser.c configparser.h:
2080 mod_ssi_exprparser.c mod_ssi_exprparser.h:
2081
2082-.PHONY: parsers
2083 parsers:
2084 else
2085 configparser.h: configparser.c
2086@@ -29,12 +45,12 @@
2087 rm -f mod_ssi_exprparser.h
2088 $(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
2089
2090-.PHONY: parsers
2091 parsers: configparser.c mod_ssi_exprparser.c
2092 endif
2093
2094 BUILT_SOURCES = parsers
2095 MAINTAINERCLEANFILES = configparser.c configparser.h mod_ssi_exprparser.c mod_ssi_exprparser.h
2096+CLEANFILES = versionstamp.h versionstamp.h.tmp
2097
2098 common_src=buffer.c log.c \
2099 keyvalue.c chunk.c \
2100@@ -58,8 +74,6 @@
2101 src = server.c response.c connections.c network.c \
2102 configfile.c configparser.c request.c proc_open.c
2103
2104-spawn_fcgi_SOURCES=spawn-fcgi.c
2105-
2106 lib_LTLIBRARIES =
2107
2108 if NO_RDYNAMIC
2109@@ -259,9 +273,10 @@
2110 configparser.h mod_ssi_exprparser.h \
2111 sys-mmap.h sys-socket.h mod_cml.h mod_cml_funcs.h \
2112 splaytree.h proc_open.h status_counter.h \
2113- mod_magnet_cache.h
2114+ mod_magnet_cache.h \
2115+ version.h
2116
2117-DEFS= @DEFS@ -DLIBRARY_DIR="\"$(libdir)\"" -DSBIN_DIR="\"$(sbindir)\""
2118+DEFS= @DEFS@ -DHAVE_VERSION_H -DLIBRARY_DIR="\"$(libdir)\"" -DSBIN_DIR="\"$(sbindir)\""
2119
2120 lighttpd_SOURCES = $(src)
2121 lighttpd_LDADD = $(PCRE_LIB) $(DL_LIB) $(SENDFILE_LIB) $(ATTR_LIB) $(common_libadd) $(SSL_LIB) $(FAM_LIBS)
2122@@ -287,3 +302,4 @@
2123
2124 noinst_HEADERS = $(hdr)
2125 EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c SConscript
2126+
2127Index: src/config.h.cmake
2128===================================================================
cdac2405
ER
2129Index: src/mod_expire.c
2130===================================================================
b57f094a
ER
2131--- src/mod_expire.c (.../tags/lighttpd-1.4.22) (revision 2504)
2132+++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 2504)
2133@@ -75,10 +75,10 @@
2134 return HANDLER_GO_ON;
2135 }
2136
2137-static int mod_expire_get_offset(server *srv, plugin_data *p, buffer *expire, int *offset) {
2138+static int mod_expire_get_offset(server *srv, plugin_data *p, buffer *expire, time_t *offset) {
2139 char *ts;
2140 int type = -1;
2141- int retts = 0;
2142+ time_t retts = 0;
2143
2144 UNUSED(p);
2145
2146@@ -302,8 +302,7 @@
2147 if (ds->key->used == 0) continue;
2148
2149 if (0 == strncmp(con->uri.path->ptr, ds->key->ptr, ct_len)) {
2150- int ts;
2151- time_t t;
2152+ time_t ts, expires;
2153 size_t len;
2154 stat_cache_entry *sce = NULL;
2155
2156@@ -312,25 +311,26 @@
2157 switch(mod_expire_get_offset(srv, p, ds->value, &ts)) {
2158 case 0:
2159 /* access */
2160- t = (ts + srv->cur_ts);
2161+ expires = (ts + srv->cur_ts);
2162 break;
2163 case 1:
2164 /* modification */
2165
2166- t = (ts + sce->st.st_mtime);
2167+ expires = (ts + sce->st.st_mtime);
2168 break;
2169 default:
2170 /* -1 is handled at parse-time */
2171 break;
2172 }
2173
2174+ /* expires should be at least srv->cur_ts */
2175+ if (expires < srv->cur_ts) expires = srv->cur_ts;
2176
2177 if (0 == (len = strftime(p->expire_tstmp->ptr, p->expire_tstmp->size - 1,
2178- "%a, %d %b %Y %H:%M:%S GMT", gmtime(&(t))))) {
2179+ "%a, %d %b %Y %H:%M:%S GMT", gmtime(&(expires))))) {
2180 /* could not set expire header, out of mem */
2181
2182 return HANDLER_GO_ON;
2183-
2184 }
2185
2186 p->expire_tstmp->used = len + 1;
2187@@ -340,7 +340,7 @@
2188
2189 /* HTTP/1.1 */
2190 buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
2191- buffer_append_long(p->expire_tstmp, ts);
2192+ buffer_append_long(p->expire_tstmp, expires - srv->cur_ts); /* as expires >= srv->cur_ts the difference is >= 0 */
2193
2194 response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
2195
cdac2405
ER
2196@@ -354,6 +354,7 @@
2197
2198 /* this function is called at dlopen() time and inits the callbacks */
2199
2200+int mod_expire_plugin_init(plugin *p);
2201 int mod_expire_plugin_init(plugin *p) {
2202 p->version = LIGHTTPD_VERSION_ID;
2203 p->name = buffer_init_string("expire");
b57f094a
ER
2204Index: src/http_auth.c
2205===================================================================
2206--- src/http_auth.c (.../tags/lighttpd-1.4.22) (revision 2504)
2207+++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 2504)
2208@@ -865,7 +865,11 @@
2209 buffer_free(username);
2210 buffer_free(password);
2211
2212- log_error_write(srv, __FILE__, __LINE__, "s", "get_password failed");
2213+ if (AUTH_BACKEND_UNSET == p->conf.auth_backend) {
2214+ log_error_write(srv, __FILE__, __LINE__, "s", "auth.backend is not set");
2215+ } else {
2216+ log_error_write(srv, __FILE__, __LINE__, "s", "get_password failed");
2217+ }
2218
2219 return 0;
2220 }
cdac2405
ER
2221Index: src/mod_redirect.c
2222===================================================================
b57f094a
ER
2223--- src/mod_redirect.c (.../tags/lighttpd-1.4.22) (revision 2504)
2224+++ src/mod_redirect.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2225@@ -271,6 +271,7 @@
2226 }
2227
2228
2229+int mod_redirect_plugin_init(plugin *p);
2230 int mod_redirect_plugin_init(plugin *p) {
2231 p->version = LIGHTTPD_VERSION_ID;
2232 p->name = buffer_init_string("redirect");
2233Index: src/mod_usertrack.c
2234===================================================================
b57f094a
ER
2235--- src/mod_usertrack.c (.../tags/lighttpd-1.4.22) (revision 2504)
2236+++ src/mod_usertrack.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2237@@ -255,6 +255,7 @@
2238
2239 /* this function is called at dlopen() time and inits the callbacks */
2240
2241+int mod_usertrack_plugin_init(plugin *p);
2242 int mod_usertrack_plugin_init(plugin *p) {
2243 p->version = LIGHTTPD_VERSION_ID;
2244 p->name = buffer_init_string("usertrack");
2245Index: src/mod_webdav.c
2246===================================================================
b57f094a
ER
2247--- src/mod_webdav.c (.../tags/lighttpd-1.4.22) (revision 2504)
2248+++ src/mod_webdav.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2249@@ -1096,7 +1096,7 @@
2250 }
2251 #endif
2252
2253-int webdav_lockdiscovery(server *srv, connection *con,
2254+static int webdav_lockdiscovery(server *srv, connection *con,
2255 buffer *locktoken, const char *lockscope, const char *locktype, int depth) {
2256
2257 buffer *b;
2258@@ -1156,7 +1156,7 @@
2259 *
2260 *
2261 */
2262-int webdav_has_lock(server *srv, connection *con, plugin_data *p, buffer *uri) {
2263+static int webdav_has_lock(server *srv, connection *con, plugin_data *p, buffer *uri) {
2264 int has_lock = 1;
2265
2266 #ifdef USE_LOCKS
2267@@ -2474,6 +2474,7 @@
2268
2269 /* this function is called at dlopen() time and inits the callbacks */
2270
2271+int mod_webdav_plugin_init(plugin *p);
2272 int mod_webdav_plugin_init(plugin *p) {
2273 p->version = LIGHTTPD_VERSION_ID;
2274 p->name = buffer_init_string("webdav");
2275Index: src/mod_status.c
2276===================================================================
b57f094a
ER
2277--- src/mod_status.c (.../tags/lighttpd-1.4.22) (revision 2504)
2278+++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2279@@ -18,6 +18,7 @@
2280 #include "plugin.h"
2281
2282 #include "inet_ntop_cache.h"
2283+#include "version.h"
2284
2285 typedef struct {
2286 buffer *config_url;
2287@@ -701,7 +702,7 @@
2288 " <title>Status</title>\n"
2289 " </head>\n"
2290 " <body>\n"
2291- " <h1>" PACKAGE_NAME " " PACKAGE_VERSION "</h1>\n"
2292+ " <h1>" PACKAGE_DESC "</h1>\n"
2293 " <table summary=\"status\" border=\"1\">\n"));
2294
2295 mod_status_header_append(b, "Server-Features");
2296@@ -853,6 +854,7 @@
cdac2405
ER
2297 return HANDLER_GO_ON;
2298 }
2299
2300+int mod_status_plugin_init(plugin *p);
2301 int mod_status_plugin_init(plugin *p) {
2302 p->version = LIGHTTPD_VERSION_ID;
2303 p->name = buffer_init_string("status");
2304Index: src/mod_compress.c
2305===================================================================
b57f094a
ER
2306--- src/mod_compress.c (.../tags/lighttpd-1.4.22) (revision 2504)
2307+++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2308@@ -104,7 +104,7 @@
2309 }
2310
2311 /* 0 on success, -1 for error */
2312-int mkdir_recursive(char *dir) {
2313+static int mkdir_recursive(char *dir) {
2314 char *p = dir;
2315
2316 if (!dir || !dir[0])
2317@@ -126,7 +126,7 @@
2318 }
2319
2320 /* 0 on success, -1 for error */
2321-int mkdir_for_file(char *filename) {
2322+static int mkdir_for_file(char *filename) {
2323 char *p = filename;
2324
2325 if (!filename || !filename[0])
2326@@ -815,6 +815,7 @@
2327 return HANDLER_GO_ON;
2328 }
2329
2330+int mod_compress_plugin_init(plugin *p);
2331 int mod_compress_plugin_init(plugin *p) {
2332 p->version = LIGHTTPD_VERSION_ID;
2333 p->name = buffer_init_string("compress");
2334Index: src/mod_ssi.c
2335===================================================================
b57f094a
ER
2336--- src/mod_ssi.c (.../tags/lighttpd-1.4.22) (revision 2504)
2337+++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2338@@ -37,6 +37,7 @@
2339 #endif
2340
2341 #include "etag.h"
2342+#include "version.h"
2343
2344 /* The newest modified time of included files for include statement */
2345 static volatile time_t include_file_last_mtime = 0;
2346@@ -139,7 +140,7 @@
cdac2405
ER
2347 return HANDLER_GO_ON;
2348 }
2349
2350-int ssi_env_add(array *env, const char *key, const char *val) {
2351+static int ssi_env_add(array *env, const char *key, const char *val) {
2352 data_string *ds;
2353
2354 if (NULL == (ds = (data_string *)array_get_unused_element(env, TYPE_STRING))) {
b57f094a
ER
2355@@ -199,6 +200,34 @@
2356 }
2357 }
2358
2359+ for (i = 0; i < con->environment->used; i++) {
2360+ data_string *ds;
2361+
2362+ ds = (data_string *)con->environment->data[i];
2363+
2364+ if (ds->value->used && ds->key->used) {
2365+ size_t j;
2366+
2367+ buffer_reset(srv->tmp_buf);
2368+ buffer_prepare_append(srv->tmp_buf, ds->key->used + 2);
2369+
2370+ for (j = 0; j < ds->key->used - 1; j++) {
2371+ char c = '_';
2372+ if (light_isalpha(ds->key->ptr[j])) {
2373+ /* upper-case */
2374+ c = ds->key->ptr[j] & ~32;
2375+ } else if (light_isdigit(ds->key->ptr[j])) {
2376+ /* copy */
2377+ c = ds->key->ptr[j];
2378+ }
2379+ srv->tmp_buf->ptr[srv->tmp_buf->used++] = c;
2380+ }
2381+ srv->tmp_buf->ptr[srv->tmp_buf->used] = '\0';
2382+
2383+ ssi_env_add(p->ssi_cgi_env, srv->tmp_buf->ptr, ds->value->ptr);
2384+ }
2385+ }
2386+
2387 return 0;
2388 }
2389
2390@@ -216,7 +245,7 @@
9ab53fe1
ER
2391
2392 array_reset(p->ssi_cgi_env);
2393
2394- ssi_env_add(p->ssi_cgi_env, CONST_STRING("SERVER_SOFTWARE"), PACKAGE_NAME"/"PACKAGE_VERSION);
2395+ ssi_env_add(p->ssi_cgi_env, CONST_STRING("SERVER_SOFTWARE"), PACKAGE_DESC);
2396 ssi_env_add(p->ssi_cgi_env, CONST_STRING("SERVER_NAME"),
2397 #ifdef HAVE_IPV6
2398 inet_ntop(srv_sock->addr.plain.sa_family,
b57f094a
ER
2399@@ -656,17 +685,22 @@
2400 if (p->if_is_false) break;
2401
2402 b = chunkqueue_get_append_buffer(con->write_queue);
2403- buffer_copy_string_len(b, CONST_STR_LEN("<pre>"));
2404 for (i = 0; i < p->ssi_vars->used; i++) {
2405 data_string *ds = (data_string *)p->ssi_vars->data[p->ssi_vars->sorted[i]];
2406
2407 buffer_append_string_buffer(b, ds->key);
2408- buffer_append_string_len(b, CONST_STR_LEN(": "));
2409- buffer_append_string_buffer(b, ds->value);
2410- buffer_append_string_len(b, CONST_STR_LEN("<br />"));
2411+ buffer_append_string_len(b, CONST_STR_LEN("="));
2412+ buffer_append_string_encoded(b, CONST_BUF_LEN(ds->value), ENCODING_MINIMAL_XML);
2413+ buffer_append_string_len(b, CONST_STR_LEN("\n"));
2414+ }
2415+ for (i = 0; i < p->ssi_cgi_env->used; i++) {
2416+ data_string *ds = (data_string *)p->ssi_cgi_env->data[p->ssi_cgi_env->sorted[i]];
2417
2418+ buffer_append_string_buffer(b, ds->key);
2419+ buffer_append_string_len(b, CONST_STR_LEN("="));
2420+ buffer_append_string_encoded(b, CONST_BUF_LEN(ds->value), ENCODING_MINIMAL_XML);
2421+ buffer_append_string_len(b, CONST_STR_LEN("\n"));
2422 }
2423- buffer_append_string_len(b, CONST_STR_LEN("</pre>"));
2424
2425 break;
2426 case SSI_EXEC: {
2427@@ -1125,6 +1159,7 @@
cdac2405
ER
2428
2429 /* this function is called at dlopen() time and inits the callbacks */
2430
2431+int mod_ssi_plugin_init(plugin *p);
2432 int mod_ssi_plugin_init(plugin *p) {
2433 p->version = LIGHTTPD_VERSION_ID;
2434 p->name = buffer_init_string("ssi");
cdac2405
ER
2435Index: src/mod_auth.c
2436===================================================================
b57f094a
ER
2437--- src/mod_auth.c (.../tags/lighttpd-1.4.22) (revision 2504)
2438+++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2439@@ -313,20 +313,20 @@
2440
2441 config_values_t cv[] = {
2442 { "auth.backend", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
2443- { "auth.backend.plain.groupfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2444- { "auth.backend.plain.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2445- { "auth.require", NULL, T_CONFIG_LOCAL, T_CONFIG_SCOPE_CONNECTION },
2446- { "auth.backend.ldap.hostname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2447- { "auth.backend.ldap.base-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2448- { "auth.backend.ldap.filter", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2449- { "auth.backend.ldap.ca-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2450- { "auth.backend.ldap.starttls", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
2451- { "auth.backend.ldap.bind-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2452+ { "auth.backend.plain.groupfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
2453+ { "auth.backend.plain.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
2454+ { "auth.require", NULL, T_CONFIG_LOCAL, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
2455+ { "auth.backend.ldap.hostname", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 4 */
2456+ { "auth.backend.ldap.base-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 5 */
2457+ { "auth.backend.ldap.filter", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 6 */
2458+ { "auth.backend.ldap.ca-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
2459+ { "auth.backend.ldap.starttls", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
2460+ { "auth.backend.ldap.bind-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
2461 { "auth.backend.ldap.bind-pw", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
2462- { "auth.backend.ldap.allow-empty-pw", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
2463- { "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2464- { "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
2465- { "auth.debug", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
2466+ { "auth.backend.ldap.allow-empty-pw", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
2467+ { "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
2468+ { "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
2469+ { "auth.debug", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
2470 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
2471 };
2472
cdac2405
ER
2473@@ -614,6 +614,7 @@
2474 #endif
2475 }
2476
2477+int mod_auth_plugin_init(plugin *p);
2478 int mod_auth_plugin_init(plugin *p) {
2479 p->version = LIGHTTPD_VERSION_ID;
2480 p->name = buffer_init_string("auth");
b57f094a
ER
2481Index: src/settings.h
2482===================================================================
2483--- src/settings.h (.../tags/lighttpd-1.4.22) (revision 2504)
2484+++ src/settings.h (.../branches/lighttpd-1.4.x) (revision 2504)
2485@@ -13,6 +13,7 @@
2486 * 64kB (no real reason, just a guess)
2487 */
2488 #define BUFFER_MAX_REUSE_SIZE (4 * 1024)
2489+#define MAX_READ_LIMIT (4*1024*1024)
2490
2491 /**
2492 * max size of the HTTP request header
acde7ead 2493Index: src/mod_cml_lua.c
170f212a 2494===================================================================
b57f094a
ER
2495--- src/mod_cml_lua.c (.../tags/lighttpd-1.4.22) (revision 2504)
2496+++ src/mod_cml_lua.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2497@@ -105,7 +105,7 @@
2498 }
2499
2500
2501-int cache_export_get_params(lua_State *L, int tbl, buffer *qrystr) {
2502+static int cache_export_get_params(lua_State *L, int tbl, buffer *qrystr) {
2503 size_t is_key = 1;
2504 size_t i;
2505 char *key = NULL, *val = NULL;
9ab53fe1
ER
2506Index: src/version.h
2507===================================================================
2508--- src/version.h (.../tags/lighttpd-1.4.22) (revision 0)
b57f094a 2509+++ src/version.h (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2510@@ -0,0 +1,12 @@
2511+#ifndef _VERSION_H_
2512+#define _VERSION_H_
2513+
2514+#ifdef HAVE_VERSION_H
2515+#include "versionstamp.h"
2516+#else
2517+#define REPO_VERSION ""
2518+#endif
2519+
2520+#define PACKAGE_DESC PACKAGE_NAME "/" PACKAGE_VERSION REPO_VERSION
2521+
2522+#endif
cdac2405
ER
2523Index: src/mod_evasive.c
2524===================================================================
b57f094a
ER
2525--- src/mod_evasive.c (.../tags/lighttpd-1.4.22) (revision 2504)
2526+++ src/mod_evasive.c (.../branches/lighttpd-1.4.x) (revision 2504)
2527@@ -27,6 +27,7 @@
2528
2529 typedef struct {
2530 unsigned short max_conns;
2531+ unsigned short silent;
2532 } plugin_config;
2533
2534 typedef struct {
2535@@ -72,7 +73,8 @@
2536 size_t i = 0;
2537
2538 config_values_t cv[] = {
2539- { "evasive.max-conns-per-ip", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
2540+ { "evasive.max-conns-per-ip", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
2541+ { "evasive.silent", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
2542 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
2543 };
2544
2545@@ -83,6 +85,7 @@
2546
2547 s = calloc(1, sizeof(plugin_config));
2548 s->max_conns = 0;
2549+ s->silent = 0;
2550
2551 cv[0].destination = &(s->max_conns);
2552
2553@@ -103,6 +106,7 @@
2554 plugin_config *s = p->config_storage[0];
2555
2556 PATCH(max_conns);
2557+ PATCH(silent);
2558
2559 /* skip the first, the global context */
2560 for (i = 1; i < srv->config_context->used; i++) {
2561@@ -118,6 +122,8 @@
2562
2563 if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.max-conns-per-ip"))) {
2564 PATCH(max_conns);
2565+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.silent"))) {
2566+ PATCH(silent);
2567 }
2568 }
2569 }
2570@@ -172,9 +178,11 @@
2571 conns_by_ip++;
2572
2573 if (conns_by_ip > p->conf.max_conns) {
2574- log_error_write(srv, __FILE__, __LINE__, "ss",
2575- inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
2576- "turned away. Too many connections.");
2577+ if (!p->conf.silent) {
2578+ log_error_write(srv, __FILE__, __LINE__, "ss",
2579+ inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
2580+ "turned away. Too many connections.");
2581+ }
2582
2583 con->http_status = 403;
2584 con->mode = DIRECT;
2585@@ -186,6 +194,7 @@
cdac2405
ER
2586 }
2587
2588
2589+int mod_evasive_plugin_init(plugin *p);
2590 int mod_evasive_plugin_init(plugin *p) {
2591 p->version = LIGHTTPD_VERSION_ID;
2592 p->name = buffer_init_string("evasive");
2593Index: src/mod_setenv.c
2594===================================================================
b57f094a
ER
2595--- src/mod_setenv.c (.../tags/lighttpd-1.4.22) (revision 2504)
2596+++ src/mod_setenv.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2597@@ -230,6 +230,7 @@
2598
2599 /* this function is called at dlopen() time and inits the callbacks */
2600
2601+int mod_setenv_plugin_init(plugin *p);
2602 int mod_setenv_plugin_init(plugin *p) {
2603 p->version = LIGHTTPD_VERSION_ID;
2604 p->name = buffer_init_string("setenv");
2605Index: src/mod_indexfile.c
2606===================================================================
b57f094a
ER
2607--- src/mod_indexfile.c (.../tags/lighttpd-1.4.22) (revision 2504)
2608+++ src/mod_indexfile.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2609@@ -206,6 +206,7 @@
2610
2611 /* this function is called at dlopen() time and inits the callbacks */
2612
2613+int mod_indexfile_plugin_init(plugin *p);
2614 int mod_indexfile_plugin_init(plugin *p) {
2615 p->version = LIGHTTPD_VERSION_ID;
2616 p->name = buffer_init_string("indexfile");
2617Index: src/mod_uploadprogress.c
2618===================================================================
cdac2405
ER
2619Index: src/mod_fastcgi.c
2620===================================================================
b57f094a
ER
2621--- src/mod_fastcgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
2622+++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
2623@@ -49,6 +49,8 @@
2624 #include <sys/wait.h>
2625 #endif
2626
2627+#include "version.h"
2628+
2629 #define FCGI_ENV_ADD_CHECK(ret, con) \
2630 if (ret == -1) { \
2631 con->http_status = 400; \
b57f094a
ER
2632@@ -316,12 +318,6 @@
2633 } plugin_config;
2634
2635 typedef struct {
2636- size_t *ptr;
2637- size_t used;
2638- size_t size;
2639-} buffer_uint;
2640-
2641-typedef struct {
2642 char **ptr;
2643
2644 size_t size;
2645@@ -331,7 +327,6 @@
2646 /* generic plugin data, shared between all connections */
2647 typedef struct {
2648 PLUGIN_DATA;
2649- buffer_uint fcgi_request_id;
2650
2651 buffer *fcgi_env;
2652
2653@@ -389,7 +384,7 @@
cdac2405
ER
2654 /* ok, we need a prototype */
2655 static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents);
2656
2657-int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2658+static int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2659 buffer_copy_string_len(b, CONST_STR_LEN("fastcgi.backend."));
2660 buffer_append_string_buffer(b, host->id);
2661 if (proc) {
b57f094a 2662@@ -400,7 +395,7 @@
cdac2405
ER
2663 return 0;
2664 }
2665
2666-int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2667+static int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2668 #define CLEAN(x) \
2669 fastcgi_status_copy_procname(b, host, proc); \
2670 buffer_append_string_len(b, CONST_STR_LEN(x)); \
b57f094a 2671@@ -465,7 +460,7 @@
cdac2405
ER
2672 free(hctx);
2673 }
2674
2675-fcgi_proc *fastcgi_process_init() {
2676+static fcgi_proc *fastcgi_process_init() {
2677 fcgi_proc *f;
2678
2679 f = calloc(1, sizeof(*f));
b57f094a 2680@@ -478,7 +473,7 @@
cdac2405
ER
2681 return f;
2682 }
2ed0f534 2683
cdac2405
ER
2684-void fastcgi_process_free(fcgi_proc *f) {
2685+static void fastcgi_process_free(fcgi_proc *f) {
2686 if (!f) return;
2ed0f534 2687
cdac2405 2688 fastcgi_process_free(f->next);
b57f094a 2689@@ -489,7 +484,7 @@
cdac2405
ER
2690 free(f);
2691 }
170f212a 2692
cdac2405
ER
2693-fcgi_extension_host *fastcgi_host_init() {
2694+static fcgi_extension_host *fastcgi_host_init() {
2695 fcgi_extension_host *f;
2696
2697 f = calloc(1, sizeof(*f));
b57f094a 2698@@ -506,7 +501,7 @@
cdac2405
ER
2699 return f;
2700 }
2701
2702-void fastcgi_host_free(fcgi_extension_host *h) {
2703+static void fastcgi_host_free(fcgi_extension_host *h) {
2704 if (!h) return;
2705
2706 buffer_free(h->id);
b57f094a 2707@@ -525,7 +520,7 @@
cdac2405
ER
2708
2709 }
2710
2711-fcgi_exts *fastcgi_extensions_init() {
2712+static fcgi_exts *fastcgi_extensions_init() {
2713 fcgi_exts *f;
2714
2715 f = calloc(1, sizeof(*f));
b57f094a 2716@@ -533,7 +528,7 @@
cdac2405
ER
2717 return f;
2718 }
2719
2720-void fastcgi_extensions_free(fcgi_exts *f) {
2721+static void fastcgi_extensions_free(fcgi_exts *f) {
2722 size_t i;
2723
2724 if (!f) return;
b57f094a 2725@@ -563,7 +558,7 @@
cdac2405
ER
2726 free(f);
2727 }
2728
2729-int fastcgi_extension_insert(fcgi_exts *ext, buffer *key, fcgi_extension_host *fh) {
2730+static int fastcgi_extension_insert(fcgi_exts *ext, buffer *key, fcgi_extension_host *fh) {
2731 fcgi_extension *fe;
2732 size_t i;
2733
b57f094a
ER
2734@@ -633,12 +628,9 @@
2735
2736 FREE_FUNC(mod_fastcgi_free) {
2737 plugin_data *p = p_d;
2738- buffer_uint *r = &(p->fcgi_request_id);
2739
2740 UNUSED(srv);
2741
2742- if (r->ptr) free(r->ptr);
2743-
2744 buffer_free(p->fcgi_env);
2745 buffer_free(p->path);
2746 buffer_free(p->parse_response);
2747@@ -710,8 +702,8 @@
2748 dst = malloc(key_len + val_len + 3);
2749 memcpy(dst, key, key_len);
2750 dst[key_len] = '=';
2751- /* add the \0 from the value */
2752- memcpy(dst + key_len + 1, val, val_len + 1);
2753+ memcpy(dst + key_len + 1, val, val_len);
2754+ dst[key_len + 1 + val_len] = '\0';
2755
2756 for (i = 0; i < env->used; i++) {
2757 if (0 == strncmp(dst, env->ptr[i], key_len + 1)) {
2758@@ -1056,10 +1048,7 @@
9ab53fe1
ER
2759 "child exited with status",
2760 WEXITSTATUS(status), host->bin_path);
2761 log_error_write(srv, __FILE__, __LINE__, "s",
2762- "If you're trying to run PHP as a FastCGI backend, make sure you're using the FastCGI-enabled version.\n"
2763- "You can find out if it is the right one by executing 'php -v' and it should display '(cgi-fcgi)' "
2764- "in the output, NOT '(cgi)' NOR '(cli)'.\n"
2765- "For more information, check http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-program"
2766+ "If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.\n"
2767 "If this is PHP on Gentoo, add 'fastcgi' to the USE flags.");
2768 } else if (WIFSIGNALED(status)) {
2769 log_error_write(srv, __FILE__, __LINE__, "sd",
b57f094a 2770@@ -1434,52 +1423,7 @@
cdac2405 2771 }
b57f094a
ER
2772
2773
2774-static size_t fcgi_requestid_new(server *srv, plugin_data *p) {
2775- size_t m = 0;
2776- size_t i;
2777- buffer_uint *r = &(p->fcgi_request_id);
2778-
2779- UNUSED(srv);
2780-
2781- for (i = 0; i < r->used; i++) {
2782- if (r->ptr[i] > m) m = r->ptr[i];
2783- }
2784-
2785- if (r->size == 0) {
2786- r->size = 16;
2787- r->ptr = malloc(sizeof(*r->ptr) * r->size);
2788- } else if (r->used == r->size) {
2789- r->size += 16;
2790- r->ptr = realloc(r->ptr, sizeof(*r->ptr) * r->size);
2791- }
2792-
2793- r->ptr[r->used++] = ++m;
2794-
2795- return m;
2796-}
2797-
2798-static int fcgi_requestid_del(server *srv, plugin_data *p, size_t request_id) {
2799- size_t i;
2800- buffer_uint *r = &(p->fcgi_request_id);
2801-
2802- UNUSED(srv);
2803-
2804- for (i = 0; i < r->used; i++) {
2805- if (r->ptr[i] == request_id) break;
2806- }
2807-
2808- if (i != r->used) {
2809- /* found */
2810-
2811- if (i != r->used - 1) {
2812- r->ptr[i] = r->ptr[r->used - 1];
2813- }
2814- r->used--;
2815- }
2816-
2817- return 0;
2818-}
cdac2405
ER
2819-void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2820+static void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2821 plugin_data *p;
2822 connection *con;
2823
b57f094a
ER
2824@@ -1495,10 +1439,6 @@
2825 srv->cur_fds--;
2826 }
2827
2828- if (hctx->request_id != 0) {
2829- fcgi_requestid_del(srv, p, hctx->request_id);
2830- }
2831-
2832 if (hctx->host && hctx->proc) {
2833 if (hctx->got_proc) {
2834 /* after the connect the process gets a load */
2835@@ -1556,8 +1496,6 @@
2836 hctx->fd = -1;
2837 }
2838
2839- fcgi_requestid_del(srv, p, hctx->request_id);
2840-
2841 fcgi_set_state(srv, hctx, FCGI_STATE_INIT);
2842
2843 hctx->request_id = 0;
2844@@ -1885,10 +1823,18 @@
9ab53fe1
ER
2845 buffer_prepare_copy(p->fcgi_env, 1024);
2846
2847
2848- FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION)),con)
2849+ if (buffer_is_empty(con->conf.server_tag)) {
2850+ FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_DESC)),con)
2851+ } else {
2852+ FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag)),con)
2853+ }
2854
2855 if (con->server_name->used) {
2856- FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name)),con)
2857+ size_t len = con->server_name->used - 1;
2858+ char *colon = strchr(con->server_name->ptr, ':');
2859+ if (colon) len = colon - con->server_name->ptr;
2860+
2861+ FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len),con)
2862 } else {
2863 #ifdef HAVE_IPV6
2864 s = inet_ntop(srv_sock->addr.plain.sa_family,
b57f094a 2865@@ -2060,7 +2006,7 @@
9ab53fe1
ER
2866
2867 fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REQUEST_URI"),
2868 con->request.orig_uri->ptr + (host->strip_request_uri->used - 2),
2869- con->request.orig_uri->used - (host->strip_request_uri->used - 2));
2870+ con->request.orig_uri->used - (host->strip_request_uri->used - 2) - 1);
2871 } else {
2872 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri)),con)
2873 }
b57f094a
ER
2874@@ -2577,7 +2523,7 @@
2875 joblist_append(srv, con);
2876
2877 buffer_copy_string_len(dcls->key, "Content-Length", sizeof("Content-Length")-1);
2878- buffer_copy_long(dcls->value, sce->st.st_size);
2879+ buffer_copy_off_t(dcls->value, sce->st.st_size);
2880 dcls = (data_string*) array_replace(con->response.headers, (data_unset *)dcls);
2881 if (dcls) dcls->free((data_unset*)dcls);
2882
2883@@ -3011,7 +2957,7 @@
2884
2885 /* move the proc-list entry down the list */
2886 if (hctx->request_id == 0) {
2887- hctx->request_id = fcgi_requestid_new(srv, p);
2888+ hctx->request_id = 1; /* always use id 1 as we don't use multiplexing */
2889 } else {
2890 log_error_write(srv, __FILE__, __LINE__, "sd",
2891 "fcgi-request is already in use:", hctx->request_id);
2892@@ -3639,7 +3585,11 @@
9ab53fe1
ER
2893 */
2894
2895 /* the rewrite is only done for /prefix/? matches */
2896- if (extension->key->ptr[0] == '/' &&
2897+ if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
2898+ buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
2899+ con->uri.path->used = 1;
2900+ con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2901+ } else if (extension->key->ptr[0] == '/' &&
2902 con->uri.path->used > extension->key->used &&
2903 NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
2904 /* rewrite uri.path and pathinfo */
b57f094a 2905@@ -3648,10 +3598,6 @@
9ab53fe1
ER
2906
2907 con->uri.path->used -= con->request.pathinfo->used - 1;
2908 con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2909- } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
2910- buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
2911- con->uri.path->used = 1;
2912- con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2913 }
2914 }
2915 }
b57f094a 2916@@ -3916,6 +3862,7 @@
cdac2405
ER
2917 }
2918
2919
2920+int mod_fastcgi_plugin_init(plugin *p);
2921 int mod_fastcgi_plugin_init(plugin *p) {
2922 p->version = LIGHTTPD_VERSION_ID;
2923 p->name = buffer_init_string("fastcgi");
2924Index: src/CMakeLists.txt
2925===================================================================
cdac2405
ER
2926Index: src/mod_access.c
2927===================================================================
b57f094a
ER
2928--- src/mod_access.c (.../tags/lighttpd-1.4.22) (revision 2504)
2929+++ src/mod_access.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2930@@ -175,6 +175,7 @@
2931 }
2932
2933
2934+int mod_access_plugin_init(plugin *p);
2935 int mod_access_plugin_init(plugin *p) {
2936 p->version = LIGHTTPD_VERSION_ID;
2937 p->name = buffer_init_string("access");
2938Index: src/mod_accesslog.c
2939===================================================================
b57f094a
ER
2940--- src/mod_accesslog.c (.../tags/lighttpd-1.4.22) (revision 2504)
2941+++ src/mod_accesslog.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
2942@@ -156,7 +156,7 @@
2943 return p;
2944 }
2945
2946-int accesslog_parse_format(server *srv, format_fields *fields, buffer *format) {
2947+static int accesslog_parse_format(server *srv, format_fields *fields, buffer *format) {
2948 size_t i, j, k = 0, start = 0;
2949
2950 if (format->used == 0) return -1;
9ab53fe1
ER
2951@@ -475,74 +475,9 @@
2952
2953 if (s->access_logfile->used < 2) continue;
2954
2955- if (s->access_logfile->ptr[0] == '|') {
2956-#ifdef HAVE_FORK
2957- /* create write pipe and spawn process */
2958-
2959- int to_log_fds[2];
2960- pid_t pid;
2961-
2962- if (pipe(to_log_fds)) {
2963- log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
2964- return HANDLER_ERROR;
2965- }
2966-
2967- /* fork, execve */
2968- switch (pid = fork()) {
2969- case 0:
2970- /* child */
2971-
2972- close(STDIN_FILENO);
2973- dup2(to_log_fds[0], STDIN_FILENO);
2974- close(to_log_fds[0]);
2975- /* not needed */
2976- close(to_log_fds[1]);
2977-
2978- openDevNull(STDERR_FILENO);
2979-
2980- /* we don't need the client socket */
2981- for (i = 3; i < 256; i++) {
2982- close(i);
2983- }
2984-
2985- /* exec the log-process (skip the | )
2986- *
2987- */
2988-
2989- execl("/bin/sh", "sh", "-c", s->access_logfile->ptr + 1, (char *)NULL);
2990-
2991- log_error_write(srv, __FILE__, __LINE__, "sss",
2992- "spawning log-process failed: ", strerror(errno),
2993- s->access_logfile->ptr + 1);
2994-
2995- exit(-1);
2996- break;
2997- case -1:
2998- /* error */
2999- log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3000- break;
3001- default:
3002- close(to_log_fds[0]);
3003-
3004- s->log_access_fd = to_log_fds[1];
3005-
3006- break;
3007- }
3008-#else
3009- return -1;
3010-#endif
3011- } else if (-1 == (s->log_access_fd =
3012- open(s->access_logfile->ptr, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3013-
3014- log_error_write(srv, __FILE__, __LINE__, "ssb",
3015- "opening access-log failed:",
3016- strerror(errno), s->access_logfile);
3017-
3018+ if (-1 == (s->log_access_fd = open_logfile_or_pipe(srv, s->access_logfile->ptr)))
3019 return HANDLER_ERROR;
3020- }
3021-#ifdef FD_CLOEXEC
3022- fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
3023-#endif
3024+
3025 }
3026
3027 return HANDLER_GO_ON;
3028@@ -876,6 +811,7 @@
cdac2405
ER
3029 }
3030
3031
3032+int mod_accesslog_plugin_init(plugin *p);
3033 int mod_accesslog_plugin_init(plugin *p) {
3034 p->version = LIGHTTPD_VERSION_ID;
3035 p->name = buffer_init_string("accesslog");
9ab53fe1
ER
3036Index: src/server.c
3037===================================================================
b57f094a
ER
3038--- src/server.c (.../tags/lighttpd-1.4.22) (revision 2504)
3039+++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3040@@ -29,6 +29,7 @@
3041 #include "plugin.h"
3042 #include "joblist.h"
3043 #include "network_backends.h"
3044+#include "version.h"
3045
3046 #ifdef HAVE_GETOPT_H
3047 #include <getopt.h>
3048@@ -64,6 +65,17 @@
3049 /* #define USE_ALARM */
3050 #endif
3051
3052+#ifdef HAVE_GETUID
3053+# ifndef HAVE_ISSETUGID
3054+
3055+static int l_issetugid() {
3056+ return (geteuid() != getuid() || getegid() != getgid());
3057+}
3058+
3059+# define issetugid l_issetugid
3060+# endif
3061+#endif
3062+
3063 static volatile sig_atomic_t srv_shutdown = 0;
3064 static volatile sig_atomic_t graceful_shutdown = 0;
3065 static volatile sig_atomic_t handle_sig_alarm = 1;
3066@@ -325,7 +337,7 @@
3067 #else
3068 # define TEXT_SSL
3069 #endif
3070- char *b = PACKAGE_NAME "-" PACKAGE_VERSION TEXT_SSL \
3071+ char *b = PACKAGE_DESC TEXT_SSL \
3072 " - a light and fast webserver\n" \
3073 "Build-Date: " __DATE__ " " __TIME__ "\n";
3074 ;
3075@@ -462,7 +474,7 @@
3076 #else
3077 # define TEXT_SSL
3078 #endif
3079- char *b = PACKAGE_NAME "-" PACKAGE_VERSION TEXT_SSL " ("__DATE__ " " __TIME__ ")" \
3080+ char *b = PACKAGE_DESC TEXT_SSL " ("__DATE__ " " __TIME__ ")" \
3081 " - a light and fast webserver\n" \
3082 "usage:\n" \
3083 " -f <name> filename of the config-file\n" \
3084@@ -589,7 +601,7 @@
3085
3086 /* UID handling */
3087 #ifdef HAVE_GETUID
3088- if (!i_am_root && (geteuid() == 0 || getegid() == 0)) {
3089+ if (!i_am_root && issetugid()) {
3090 /* we are setuid-root */
3091
3092 log_error_write(srv, __FILE__, __LINE__, "s",
cdac2405
ER
3093Index: src/mod_dirlisting.c
3094===================================================================
b57f094a
ER
3095--- src/mod_dirlisting.c (.../tags/lighttpd-1.4.22) (revision 2504)
3096+++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3097@@ -31,6 +31,8 @@
3098 #include <attr/attributes.h>
3099 #endif
3100
3101+#include "version.h"
3102+
3103 /* plugin config for all request/connections */
3104
3105 typedef struct {
b57f094a
ER
3106@@ -52,8 +54,11 @@
3107 unsigned short hide_dot_files;
3108 unsigned short show_readme;
3109 unsigned short hide_readme_file;
3110+ unsigned short encode_readme;
3111 unsigned short show_header;
3112 unsigned short hide_header_file;
3113+ unsigned short encode_header;
3114+ unsigned short auto_layout;
3115
3116 excludes_buffer *excludes;
3117
3118@@ -73,7 +78,7 @@
cdac2405
ER
3119 plugin_config conf;
3120 } plugin_data;
3121
3122-excludes_buffer *excludes_buffer_init(void) {
3123+static excludes_buffer *excludes_buffer_init(void) {
3124 excludes_buffer *exb;
3125
3126 exb = calloc(1, sizeof(*exb));
b57f094a 3127@@ -81,7 +86,7 @@
cdac2405
ER
3128 return exb;
3129 }
3130
3131-int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3132+static int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3133 #ifdef HAVE_PCRE_H
3134 size_t i;
3135 const char *errptr;
b57f094a 3136@@ -128,7 +133,7 @@
cdac2405
ER
3137 #endif
3138 }
3139
3140-void excludes_buffer_free(excludes_buffer *exb) {
3141+static void excludes_buffer_free(excludes_buffer *exb) {
3142 #ifdef HAVE_PCRE_H
3143 size_t i;
3144
b57f094a
ER
3145@@ -243,6 +248,9 @@
3146 #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
3147 #define CONFIG_DIR_LISTING "server.dir-listing"
3148 #define CONFIG_SET_FOOTER "dir-listing.set-footer"
3149+#define CONFIG_ENCODE_README "dir-listing.encode-readme"
3150+#define CONFIG_ENCODE_HEADER "dir-listing.encode-header"
3151+#define CONFIG_AUTO_LAYOUT "dir-listing.auto-layout"
3152
3153
3154 SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
3155@@ -260,7 +268,10 @@
3156 { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
3157 { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
3158 { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
3159- { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
3160+ { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
3161+ { CONFIG_ENCODE_README, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
3162+ { CONFIG_ENCODE_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
3163+ { CONFIG_AUTO_LAYOUT, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
3164
3165 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
3166 };
3167@@ -282,6 +293,10 @@
3168 s->hide_readme_file = 0;
3169 s->show_header = 0;
3170 s->hide_header_file = 0;
3171+ s->encode_readme = 1;
3172+ s->encode_header = 1;
3173+ s->auto_layout = 1;
3174+
3175 s->encoding = buffer_init();
3176 s->set_footer = buffer_init();
3177
3178@@ -296,6 +311,9 @@
3179 cv[8].destination = &(s->hide_header_file);
3180 cv[9].destination = &(s->dir_listing); /* old name */
3181 cv[10].destination = s->set_footer;
3182+ cv[11].destination = &(s->encode_readme);
3183+ cv[12].destination = &(s->encode_header);
3184+ cv[13].destination = &(s->auto_layout);
3185
3186 p->config_storage[i] = s;
3187 ca = ((data_config *)srv->config_context->data[i])->value;
3188@@ -326,6 +344,9 @@
3189 PATCH(hide_header_file);
3190 PATCH(excludes);
3191 PATCH(set_footer);
3192+ PATCH(encode_readme);
3193+ PATCH(encode_header);
3194+ PATCH(auto_layout);
3195
3196 /* skip the first, the global context */
3197 for (i = 1; i < srv->config_context->used; i++) {
3198@@ -360,6 +381,12 @@
3199 PATCH(set_footer);
3200 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
3201 PATCH(excludes);
3202+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ENCODE_README))) {
3203+ PATCH(encode_readme);
3204+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ENCODE_HEADER))) {
3205+ PATCH(encode_header);
3206+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_AUTO_LAYOUT))) {
3207+ PATCH(auto_layout);
3208 }
3209 }
3210 }
3211@@ -454,57 +481,59 @@
3212 static void http_list_directory_header(server *srv, connection *con, plugin_data *p, buffer *out) {
3213 UNUSED(srv);
3214
3215- buffer_append_string_len(out, CONST_STR_LEN(
3216- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
3217- "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"
3218- "<head>\n"
3219- "<title>Index of "
3220- ));
3221- buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
3222- buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
3223-
3224- if (p->conf.external_css->used > 1) {
3225- buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
3226- buffer_append_string_buffer(out, p->conf.external_css);
3227- buffer_append_string_len(out, CONST_STR_LEN("\" />\n"));
3228- } else {
3229+ if (p->conf.auto_layout) {
3230 buffer_append_string_len(out, CONST_STR_LEN(
3231- "<style type=\"text/css\">\n"
3232- "a, a:active {text-decoration: none; color: blue;}\n"
3233- "a:visited {color: #48468F;}\n"
3234- "a:hover, a:focus {text-decoration: underline; color: red;}\n"
3235- "body {background-color: #F5F5F5;}\n"
3236- "h2 {margin-bottom: 12px;}\n"
3237- "table {margin-left: 12px;}\n"
3238- "th, td {"
3239- " font: 90% monospace;"
3240- " text-align: left;"
3241- "}\n"
3242- "th {"
3243- " font-weight: bold;"
3244- " padding-right: 14px;"
3245- " padding-bottom: 3px;"
3246- "}\n"
3247- "td {padding-right: 14px;}\n"
3248- "td.s, th.s {text-align: right;}\n"
3249- "div.list {"
3250- " background-color: white;"
3251- " border-top: 1px solid #646464;"
3252- " border-bottom: 1px solid #646464;"
3253- " padding-top: 10px;"
3254- " padding-bottom: 14px;"
3255- "}\n"
3256- "div.foot {"
3257- " font: 90% monospace;"
3258- " color: #787878;"
3259- " padding-top: 4px;"
3260- "}\n"
3261- "</style>\n"
3262+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
3263+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"
3264+ "<head>\n"
3265+ "<title>Index of "
3266 ));
3267+ buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
3268+ buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
3269+
3270+ if (p->conf.external_css->used > 1) {
3271+ buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
3272+ buffer_append_string_buffer(out, p->conf.external_css);
3273+ buffer_append_string_len(out, CONST_STR_LEN("\" />\n"));
3274+ } else {
3275+ buffer_append_string_len(out, CONST_STR_LEN(
3276+ "<style type=\"text/css\">\n"
3277+ "a, a:active {text-decoration: none; color: blue;}\n"
3278+ "a:visited {color: #48468F;}\n"
3279+ "a:hover, a:focus {text-decoration: underline; color: red;}\n"
3280+ "body {background-color: #F5F5F5;}\n"
3281+ "h2 {margin-bottom: 12px;}\n"
3282+ "table {margin-left: 12px;}\n"
3283+ "th, td {"
3284+ " font: 90% monospace;"
3285+ " text-align: left;"
3286+ "}\n"
3287+ "th {"
3288+ " font-weight: bold;"
3289+ " padding-right: 14px;"
3290+ " padding-bottom: 3px;"
3291+ "}\n"
3292+ "td {padding-right: 14px;}\n"
3293+ "td.s, th.s {text-align: right;}\n"
3294+ "div.list {"
3295+ " background-color: white;"
3296+ " border-top: 1px solid #646464;"
3297+ " border-bottom: 1px solid #646464;"
3298+ " padding-top: 10px;"
3299+ " padding-bottom: 14px;"
3300+ "}\n"
3301+ "div.foot {"
3302+ " font: 90% monospace;"
3303+ " color: #787878;"
3304+ " padding-top: 4px;"
3305+ "}\n"
3306+ "</style>\n"
3307+ ));
3308+ }
3309+
3310+ buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3311 }
3312
3313- buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3314-
3315 /* HEADER.txt */
3316 if (p->conf.show_header) {
3317 stream s;
3318@@ -515,9 +544,13 @@
3319 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("HEADER.txt"));
3320
3321 if (-1 != stream_open(&s, p->tmp_buf)) {
3322- buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"header\">"));
3323- buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3324- buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3325+ if (p->conf.encode_header) {
3326+ buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"header\">"));
3327+ buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3328+ buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3329+ } else {
3330+ buffer_append_string_len(out, s.start, s.size);
3331+ }
3332 }
3333 stream_close(&s);
3334 }
3335@@ -564,30 +597,36 @@
3336 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("README.txt"));
3337
3338 if (-1 != stream_open(&s, p->tmp_buf)) {
3339- buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"readme\">"));
3340- buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3341- buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3342+ if (p->conf.encode_readme) {
3343+ buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"readme\">"));
3344+ buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3345+ buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3346+ } else {
3347+ buffer_append_string_len(out, s.start, s.size);
3348+ }
3349 }
3350 stream_close(&s);
3351 }
3352
3353- buffer_append_string_len(out, CONST_STR_LEN(
3354- "<div class=\"foot\">"
3355- ));
3356+ if(p->conf.auto_layout) {
3357+ buffer_append_string_len(out, CONST_STR_LEN(
3358+ "<div class=\"foot\">"
3359+ ));
3360
3361- if (p->conf.set_footer->used > 1) {
3362- buffer_append_string_buffer(out, p->conf.set_footer);
3363- } else if (buffer_is_empty(con->conf.server_tag)) {
9ab53fe1 3364- buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_NAME "/" PACKAGE_VERSION));
b57f094a
ER
3365- } else {
3366- buffer_append_string_buffer(out, con->conf.server_tag);
3367+ if (p->conf.set_footer->used > 1) {
3368+ buffer_append_string_buffer(out, p->conf.set_footer);
3369+ } else if (buffer_is_empty(con->conf.server_tag)) {
3370+ buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_DESC));
3371+ } else {
3372+ buffer_append_string_buffer(out, con->conf.server_tag);
3373+ }
3374+
3375+ buffer_append_string_len(out, CONST_STR_LEN(
3376+ "</div>\n"
3377+ "</body>\n"
3378+ "</html>\n"
3379+ ));
9ab53fe1 3380 }
b57f094a
ER
3381-
3382- buffer_append_string_len(out, CONST_STR_LEN(
3383- "</div>\n"
3384- "</body>\n"
3385- "</html>\n"
3386- ));
3387 }
3388
3389 static int http_list_directory(server *srv, connection *con, plugin_data *p, buffer *dir) {
3390@@ -904,6 +943,7 @@
cdac2405
ER
3391
3392 /* this function is called at dlopen() time and inits the callbacks */
3393
3394+int mod_dirlisting_plugin_init(plugin *p);
3395 int mod_dirlisting_plugin_init(plugin *p) {
3396 p->version = LIGHTTPD_VERSION_ID;
3397 p->name = buffer_init_string("dirlisting");
3398Index: src/mod_magnet.c
3399===================================================================
b57f094a
ER
3400--- src/mod_magnet.c (.../tags/lighttpd-1.4.22) (revision 2504)
3401+++ src/mod_magnet.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3402@@ -365,6 +365,8 @@
3403 MAGNET_ENV_REQUEST_METHOD,
3404 MAGNET_ENV_REQUEST_URI,
3405 MAGNET_ENV_REQUEST_ORIG_URI,
3406+ MAGNET_ENV_REQUEST_PATH_INFO,
3407+ MAGNET_ENV_REQUEST_REMOTE_IP,
3408 MAGNET_ENV_REQUEST_PROTOCOL
3409 } type;
3410 } magnet_env_t;
3411@@ -387,6 +389,8 @@
3412 { "request.method", MAGNET_ENV_REQUEST_METHOD },
3413 { "request.uri", MAGNET_ENV_REQUEST_URI },
3414 { "request.orig-uri", MAGNET_ENV_REQUEST_ORIG_URI },
3415+ { "request.path-info", MAGNET_ENV_REQUEST_PATH_INFO },
3416+ { "request.remote-ip", MAGNET_ENV_REQUEST_REMOTE_IP },
3417 { "request.protocol", MAGNET_ENV_REQUEST_PROTOCOL },
3418
3419 { NULL, MAGNET_ENV_UNSET }
3420@@ -420,6 +424,8 @@
3421 break;
3422 case MAGNET_ENV_REQUEST_URI: dest = con->request.uri; break;
3423 case MAGNET_ENV_REQUEST_ORIG_URI: dest = con->request.orig_uri; break;
3424+ case MAGNET_ENV_REQUEST_PATH_INFO: dest = con->request.pathinfo; break;
3425+ case MAGNET_ENV_REQUEST_REMOTE_IP: dest = con->dst_addr_buf; break;
3426 case MAGNET_ENV_REQUEST_PROTOCOL:
3427 buffer_copy_string(srv->tmp_buf, get_http_version_name(con->request.http_version));
3428 dest = srv->tmp_buf;
3429@@ -840,6 +846,7 @@
cdac2405
ER
3430
3431 /* this function is called at dlopen() time and inits the callbacks */
3432
3433+int mod_magnet_plugin_init(plugin *p);
3434 int mod_magnet_plugin_init(plugin *p) {
3435 p->version = LIGHTTPD_VERSION_ID;
3436 p->name = buffer_init_string("magnet");
9ab53fe1 3437@@ -856,6 +863,7 @@
cdac2405
ER
3438 }
3439
3440 #else
3441+int mod_magnet_plugin_init(plugin *p);
3442 int mod_magnet_plugin_init(plugin *p) {
3443 UNUSED(p);
3444 return -1;
9ab53fe1
ER
3445Index: src/log.c
3446===================================================================
b57f094a
ER
3447--- src/log.c (.../tags/lighttpd-1.4.22) (revision 2504)
3448+++ src/log.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3449@@ -54,13 +54,94 @@
3450 return (tmpfd != -1) ? 0 : -1;
3451 }
3452
3453+int open_logfile_or_pipe(server *srv, const char* logfile) {
3454+ int fd;
3455+
3456+ if (logfile[0] == '|') {
3457+#ifdef HAVE_FORK
3458+ /* create write pipe and spawn process */
3459+
3460+ int to_log_fds[2];
3461+ pid_t pid;
3462+ int i;
3463+
3464+ if (pipe(to_log_fds)) {
3465+ log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
3466+ return -1;
3467+ }
3468+
3469+ /* fork, execve */
3470+ switch (pid = fork()) {
3471+ case 0:
3472+ /* child */
3473+ close(STDIN_FILENO);
3474+
3475+ /* dup the filehandle to STDIN */
3476+ if (to_log_fds[0] != STDIN_FILENO) {
3477+ if (STDIN_FILENO != dup2(to_log_fds[0], STDIN_FILENO)) {
3478+ log_error_write(srv, __FILE__, __LINE__, "ss",
3479+ "dup2 failed: ", strerror(errno));
3480+ exit(-1);
3481+ }
3482+ close(to_log_fds[0]);
3483+ }
3484+ close(to_log_fds[1]);
3485+
3486+#ifndef FD_CLOEXEC
3487+ /* we don't need the client socket */
3488+ for (i = 3; i < 256; i++) {
3489+ close(i);
3490+ }
3491+#endif
3492+
3493+ /* close old stderr */
3494+ openDevNull(STDERR_FILENO);
3495+
3496+ /* exec the log-process (skip the | ) */
3497+ execl("/bin/sh", "sh", "-c", logfile + 1, NULL);
3498+ log_error_write(srv, __FILE__, __LINE__, "sss",
3499+ "spawning log process failed: ", strerror(errno),
3500+ logfile + 1);
3501+
3502+ exit(-1);
3503+ break;
3504+ case -1:
3505+ /* error */
3506+ log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3507+ return -1;
3508+ default:
3509+ close(to_log_fds[0]);
3510+ fd = to_log_fds[1];
3511+ break;
3512+ }
3513+
3514+#else
3515+ return -1;
3516+#endif
3517+ } else if (-1 == (fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3518+ log_error_write(srv, __FILE__, __LINE__, "SSSS",
3519+ "opening errorlog '", logfile,
3520+ "' failed: ", strerror(errno));
3521+
3522+ return -1;
3523+ }
3524+
3525+#ifdef FD_CLOEXEC
3526+ fcntl(fd, F_SETFD, FD_CLOEXEC);
3527+#endif
3528+
3529+ return fd;
3530+}
3531+
3532+
3533 /**
3534 * open the errorlog
3535 *
3536- * we have 3 possibilities:
3537+ * we have 4 possibilities:
3538 * - stderr (default)
3539 * - syslog
3540 * - logfile
3541+ * - pipe
3542 *
3543 * if the open failed, report to the user and die
3544 *
3545@@ -80,18 +161,10 @@
3546 } else if (!buffer_is_empty(srv->srvconf.errorlog_file)) {
3547 const char *logfile = srv->srvconf.errorlog_file->ptr;
3548
3549- if (-1 == (srv->errorlog_fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3550- log_error_write(srv, __FILE__, __LINE__, "SSSS",
3551- "opening errorlog '", logfile,
3552- "' failed: ", strerror(errno));
3553-
3554+ if (-1 == (srv->errorlog_fd = open_logfile_or_pipe(srv, logfile))) {
3555 return -1;
3556 }
3557-#ifdef FD_CLOEXEC
3558- /* close fd on exec (cgi) */
3559- fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
3560-#endif
3561- srv->errorlog_mode = ERRORLOG_FILE;
3562+ srv->errorlog_mode = (logfile[0] == '|') ? ERRORLOG_PIPE : ERRORLOG_FILE;
3563 }
3564
3565 log_error_write(srv, __FILE__, __LINE__, "s", "server started");
3566@@ -122,7 +195,7 @@
3567 */
3568
3569 int log_error_cycle(server *srv) {
3570- /* only cycle if we are not in syslog-mode */
3571+ /* only cycle if the error log is a file */
3572
3573 if (srv->errorlog_mode == ERRORLOG_FILE) {
3574 const char *logfile = srv->srvconf.errorlog_file->ptr;
3575@@ -130,7 +203,7 @@
3576
3577 int new_fd;
3578
3579- if (-1 == (new_fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3580+ if (-1 == (new_fd = open_logfile_or_pipe(srv, logfile))) {
3581 /* write to old log */
3582 log_error_write(srv, __FILE__, __LINE__, "SSSSS",
3583 "cycling errorlog '", logfile,
3584@@ -158,6 +231,7 @@
3585
3586 int log_error_close(server *srv) {
3587 switch(srv->errorlog_mode) {
3588+ case ERRORLOG_PIPE:
3589 case ERRORLOG_FILE:
3590 close(srv->errorlog_fd);
3591 break;
3592@@ -177,6 +251,7 @@
3593 va_list ap;
3594
3595 switch(srv->errorlog_mode) {
3596+ case ERRORLOG_PIPE:
3597 case ERRORLOG_FILE:
3598 case ERRORLOG_STDERR:
3599 /* cache the generated timestamp */
3600@@ -270,6 +345,7 @@
3601 va_end(ap);
3602
3603 switch(srv->errorlog_mode) {
3604+ case ERRORLOG_PIPE:
3605 case ERRORLOG_FILE:
3606 buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
3607 write(srv->errorlog_fd, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
3608Index: src/log.h
3609===================================================================
b57f094a
ER
3610--- src/log.h (.../tags/lighttpd-1.4.22) (revision 2504)
3611+++ src/log.h (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3612@@ -10,6 +10,8 @@
3613
3614 #define WP() log_error_write(srv, __FILE__, __LINE__, "");
3615
3616+int open_logfile_or_pipe(server *srv, const char* logfile);
3617+
3618 int log_error_open(server *srv);
3619 int log_error_close(server *srv);
3620 int log_error_write(server *srv, const char *filename, unsigned int line, const char *fmt, ...);
cdac2405
ER
3621Index: src/fdevent.c
3622===================================================================
b57f094a
ER
3623--- src/fdevent.c (.../tags/lighttpd-1.4.22) (revision 2504)
3624+++ src/fdevent.c (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
3625@@ -92,7 +92,7 @@
3626 return 0;
3627 }
3628
3629-fdnode *fdnode_init() {
3630+static fdnode *fdnode_init() {
3631 fdnode *fdn;
3632
3633 fdn = calloc(1, sizeof(*fdn));
3634@@ -100,7 +100,7 @@
3635 return fdn;
3636 }
3637
3638-void fdnode_free(fdnode *fdn) {
3639+static void fdnode_free(fdnode *fdn) {
3640 free(fdn);
3641 }
3642
9ab53fe1
ER
3643Index: tests/fcgi-responder.c
3644===================================================================
b57f094a
ER
3645--- tests/fcgi-responder.c (.../tags/lighttpd-1.4.22) (revision 2504)
3646+++ tests/fcgi-responder.c (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3647@@ -40,7 +40,13 @@
3648 printf("Status: 500 Internal Foo\r\n\r\n");
3649 }
3650
3651- printf("test123");
3652+ if (0 == strcmp(p, "path_info")) {
3653+ printf("%s", getenv("PATH_INFO"));
3654+ } else if (0 == strcmp(p, "script_name")) {
3655+ printf("%s", getenv("SCRIPT_NAME"));
3656+ } else {
3657+ printf("test123");
3658+ }
3659 }
3660
3661 return 0;
3662Index: tests/mod-fastcgi.t
3663===================================================================
b57f094a
ER
3664--- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.22) (revision 2504)
3665+++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3666@@ -7,7 +7,7 @@
3667 }
3668
3669 use strict;
3670-use Test::More tests => 50;
3671+use Test::More tests => 52;
3672 use LightyTest;
3673
3674 my $tf = LightyTest->new();
3675@@ -166,7 +166,7 @@
3676 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ];
3677 ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off');
3678
3679-
3680+
3681 ok($tf->stop_proc == 0, "Stopping lighttpd");
3682
3683
3684@@ -282,7 +282,7 @@
3685
3686
3687 SKIP: {
3688- skip "no fcgi-responder found", 9 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
3689+ skip "no fcgi-responder found", 11 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
3690
3691 $tf->{CONFIGFILE} = 'fastcgi-responder.conf';
3692 ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
3693@@ -319,6 +319,23 @@
3694 ok($tf->handle_http($t) == 0, 'line-ending \r\n + \r\n');
3695
3696 $t->{REQUEST} = ( <<EOF
3697+GET /abc/def/ghi?path_info HTTP/1.0
3698+Host: wsgi.example.org
3699+EOF
3700+ );
3701+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/abc/def/ghi' } ];
3702+ ok($tf->handle_http($t) == 0, 'PATH_INFO (wsgi)');
3703+
3704+ $t->{REQUEST} = ( <<EOF
3705+GET /abc/def/ghi?script_name HTTP/1.0
3706+Host: wsgi.example.org
3707+EOF
3708+ );
3709+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
3710+ ok($tf->handle_http($t) == 0, 'SCRIPT_NAME (wsgi)');
3711+
3712+
3713+ $t->{REQUEST} = ( <<EOF
3714 GET /index.fcgi?die-at-end HTTP/1.0
3715 Host: www.example.org
3716 EOF
3717Index: tests/fastcgi-responder.conf
3718===================================================================
b57f094a
ER
3719--- tests/fastcgi-responder.conf (.../tags/lighttpd-1.4.22) (revision 2504)
3720+++ tests/fastcgi-responder.conf (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3721@@ -159,3 +159,15 @@
3722 server.name = "zzz.example.org"
3723 }
3724
3725+$HTTP["host"] == "wsgi.example.org" {
3726+ fastcgi.server = (
3727+ "/" =>
3728+ ( (
3729+ "host" => "127.0.0.1", "port" => 10000,
3730+ "fix-root-scriptname" => "enable",
3731+ "check-local" => "disable",
3732+ "bin-path" => env.SRCDIR + "/fcgi-responder",
3733+ "max-procs" => 1,
3734+ ) ),
3735+ )
3736+}
3737Index: tests/LightyTest.pm
3738===================================================================
b57f094a
ER
3739--- tests/LightyTest.pm (.../tags/lighttpd-1.4.22) (revision 2504)
3740+++ tests/LightyTest.pm (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3741@@ -6,7 +6,8 @@
3742 use Test::More;
3743 use Socket;
3744 use Cwd 'abs_path';
3745-use POSIX ":sys_wait_h";
3746+use POSIX qw(:sys_wait_h dup2);
3747+use Errno qw(EADDRINUSE);
3748
3749 sub mtime {
3750 my $file = shift;
3751@@ -344,8 +345,14 @@
3752 return -1;
3753 }
3754 if ($child == 0) {
3755- my $cmd = $self->{BINDIR}.'/spawn-fcgi -n -p '.$port.' -f "'.$binary.'"';
3756- exec $cmd or die($?);
3757+ my $iaddr = inet_aton('localhost') || die "no host: localhost";
3758+ my $proto = getprotobyname('tcp');
3759+ socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
3760+ setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die "setsockopt: $!";
3761+ bind(SOCK, sockaddr_in($port, $iaddr)) || die "bind: $!";
3762+ listen(SOCK, 1024) || die "listen: $!";
3763+ dup2(fileno(SOCK), 0) || die "dup2: $!";
3764+ exec $binary or die($?);
3765 } else {
3766 if (0 != $self->wait_for_port_with_proc($port, $child)) {
3767 diag(sprintf('The process %i is not up (port %i, %s)', $child, $port, $binary));
3768Index: configure.ac
3769===================================================================
3770--- configure.ac (.../tags/lighttpd-1.4.22) (revision 0)
b57f094a 3771+++ configure.ac (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
3772@@ -0,0 +1,714 @@
3773+# -*- Autoconf -*-
3774+# Process this file with autoconf to produce a configure script.
3775+AC_PREREQ(2.57)
b57f094a 3776+AC_INIT([lighttpd], [1.4.23], [contact@lighttpd.net])
9ab53fe1
ER
3777+AC_CONFIG_SRCDIR([src/server.c])
3778+AC_CONFIG_HEADER([config.h])
3779+
3780+AC_CANONICAL_TARGET
3781+
3782+AM_INIT_AUTOMAKE
3783+
3784+# Checks for programs.
3785+AC_PROG_CC
3786+AM_PROG_CC_C_O
3787+AC_PROG_LD
3788+AC_PROG_INSTALL
3789+AC_PROG_AWK
3790+AC_PROG_CPP
3791+dnl AC_PROG_CXX
3792+AC_PROG_LN_S
3793+AC_PROG_MAKE_SET
3794+
3795+dnl check environment
3796+AC_AIX
3797+AC_ISC_POSIX
3798+AC_MINIX
3799+
3800+dnl AC_CANONICAL_HOST
3801+case $host_os in
3802+ *darwin*|*cygwin*|*aix*|*mingw* ) NO_RDYNAMIC=yes;;
3803+ * ) NO_RDYNAMIC=no;;
3804+esac
3805+AM_CONDITIONAL(NO_RDYNAMIC, test x$NO_RDYNAMIC = xyes)
3806+
3807+AC_EXEEXT
3808+
3809+dnl more automake stuff
3810+AM_C_PROTOTYPES
3811+
3812+dnl libtool
3813+AC_DISABLE_STATIC
3814+AC_ENABLE_SHARED
3815+
3816+AC_LIBTOOL_DLOPEN
3817+AC_PROG_LIBTOOL
3818+
3819+dnl for solaris
3820+CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__"
3821+
3822+# Checks for header files.
3823+AC_HEADER_STDC
3824+AC_HEADER_SYS_WAIT
3825+AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \
3826+sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \
3827+getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \
3828+sys/mman.h sys/event.h sys/port.h pwd.h sys/syslimits.h \
3829+sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h])
3830+
3831+# Checks for typedefs, structures, and compiler characteristics.
3832+AC_C_CONST
3833+AC_C_INLINE
3834+AC_C_CHAR_UNSIGNED
3835+AC_TYPE_OFF_T
3836+AC_TYPE_PID_T
3837+AC_TYPE_SIZE_T
3838+
3839+AC_CHECK_MEMBER(struct tm.tm_gmtoff,[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm])],,[#include <time.h>])
3840+AC_CHECK_TYPES(struct sockaddr_storage,,,[#include <sys/socket.h>])
3841+AC_CHECK_TYPES(socklen_t,,,[#include <sys/types.h>
3842+#include <sys/socket.h>])
3843+
3844+# Checks for library functions.
3845+AC_FUNC_FORK
3846+dnl AC_FUNC_MALLOC
3847+#AC_FUNC_MMAP
3848+dnl AC_FUNC_REALLOC
3849+AC_TYPE_SIGNAL
3850+AC_FUNC_STAT
3851+AC_FUNC_STRFTIME
b57f094a 3852+AC_CHECK_FUNCS([issetugid inet_pton])
9ab53fe1
ER
3853+
3854+dnl Checks for database.
3855+MYSQL_INCLUDE=""
3856+MYSQL_LIBS=""
3857+
3858+AC_MSG_CHECKING(for MySQL support)
3859+AC_ARG_WITH(mysql,
3860+ AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']),
3861+ [WITH_MYSQL=$withval],[WITH_MYSQL=no])
3862+
3863+if test "$WITH_MYSQL" != "no"; then
3864+ AC_MSG_RESULT(yes)
3865+ if test "$WITH_MYSQL" = "yes"; then
3866+ AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
3867+ else
3868+ MYSQL_CONFIG=$WITH_MYSQL
3869+ fi
3870+
3871+ if test "$MYSQL_CONFIG" = ""; then
3872+ AC_MSG_ERROR(mysql_config is not found)
3873+ fi
3874+ if test \! -x $MYSQL_CONFIG; then
3875+ AC_MSG_ERROR(mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config)
3876+ fi
3877+
3878+ if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then
3879+ MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`"
3880+ else
3881+ MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`"
3882+ fi
3883+ MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`"
3884+
3885+ AC_MSG_CHECKING(for MySQL includes at)
3886+ AC_MSG_RESULT($MYSQL_INCLUDE)
3887+
3888+ AC_MSG_CHECKING(for MySQL libraries at)
3889+ AC_MSG_RESULT($MYSQL_LIBS)
3890+dnl check for errmsg.h, which isn't installed by some versions of 3.21
3891+ old_CPPFLAGS="$CPPFLAGS"
3892+ CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
3893+ AC_CHECK_HEADERS(errmsg.h mysql.h)
3894+ CPPFLAGS="$old_CPPFLAGS"
3895+
3896+ AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
3897+else
3898+ AC_MSG_RESULT(no)
3899+fi
3900+
3901+AC_SUBST(MYSQL_LIBS)
3902+AC_SUBST(MYSQL_INCLUDE)
3903+
3904+dnl Check for LDAP
3905+AC_MSG_CHECKING(for LDAP support)
3906+AC_ARG_WITH(ldap, AC_HELP_STRING([--with-ldap],[enable LDAP support]),
3907+[WITH_LDAP=$withval], [WITH_LDAP=no])
3908+AC_MSG_RESULT([$withval])
3909+if test "$WITH_LDAP" != "no"; then
3910+ AC_CHECK_LIB(ldap, ldap_bind, [
3911+ AC_CHECK_HEADERS([ldap.h],[
3912+ LDAP_LIB=-lldap
3913+ AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
3914+ AC_DEFINE([HAVE_LDAP_H], [1])
3915+ AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
3916+ ])
3917+ ])
3918+ AC_SUBST(LDAP_LIB)
3919+ AC_CHECK_LIB(lber, ber_printf, [
3920+ AC_CHECK_HEADERS([lber.h],[
3921+ LBER_LIB=-llber
3922+ AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
3923+ AC_DEFINE([HAVE_LBER_H], [1])
3924+ ])
3925+ ])
3926+ AC_SUBST(LBER_LIB)
3927+fi
3928+
3929+dnl Check for xattr
3930+AC_MSG_CHECKING(for extended attributes support)
3931+AC_ARG_WITH(attr, AC_HELP_STRING([--with-attr],[enable extended attribute support]),
3932+[WITH_ATTR=$withval],[WITH_ATTR=no])
3933+AC_MSG_RESULT($withval)
3934+if test "$WITH_ATTR" != "no"; then
3935+ AC_CHECK_LIB(attr, attr_get, [
3936+ AC_CHECK_HEADERS([attr/attributes.h],[
3937+ ATTR_LIB=-lattr
3938+ AC_DEFINE([HAVE_XATTR], [1], [libattr])
3939+ AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
3940+ ])
3941+ ])
3942+ AC_SUBST(ATTR_LIB)
3943+fi
3944+
3945+## openssl on solaris needs -lsocket -lnsl
3946+AC_SEARCH_LIBS(socket,socket)
3947+AC_SEARCH_LIBS(gethostbyname,nsl socket)
3948+AC_SEARCH_LIBS(hstrerror,resolv)
3949+
3950+save_LIBS=$LIBS
3951+AC_SEARCH_LIBS(dlopen,dl,[
3952+ AC_CHECK_HEADERS([dlfcn.h],[
3953+ if test "$ac_cv_search_dlopen" != no; then
3954+ test "$ac_cv_search_dlopen" = "none required" || DL_LIB="$ac_cv_search_dlopen"
3955+ fi
3956+
3957+ AC_DEFINE([HAVE_LIBDL], [1], [libdl])
3958+ AC_DEFINE([HAVE_DLFCN_H], [1])
3959+ ])
3960+])
3961+LIBS=$save_LIBS
3962+AC_SUBST(DL_LIB)
3963+
3964+dnl Check for valgrind
3965+AC_MSG_CHECKING(for valgrind)
3966+AC_ARG_WITH(valgrind, AC_HELP_STRING([--with-valgrind],[enable internal support for valgrind]),
3967+[WITH_VALGRIND=$withval],[WITH_VALGRIND=no])
3968+AC_MSG_RESULT([$WITH_VALGRIND])
3969+if test "$WITH_VALGRIND" != "no"; then
3970+ AC_CHECK_HEADERS([valgrind/valgrind.h])
3971+fi
3972+
3973+dnl Check for openssl
3974+AC_MSG_CHECKING(for OpenSSL)
3975+AC_ARG_WITH(openssl,
3976+ AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[Include openssl support (default no)]),
3977+ [WITH_OPENSSL=$withval],[WITH_OPENSSL=no])
3978+
3979+if test "$WITH_OPENSSL" != "no"; then
3980+ use_openssl=yes
3981+ if test "$WITH_OPENSSL" != "yes"; then
3982+ CPPFLAGS="$CPPFLAGS -I$WITH_OPENSSL/include"
3983+ LDFLAGS="$LDFLAGS -L$WITH_OPENSSL/lib"
3984+ fi
3985+else
3986+ use_openssl=no
3987+fi
3988+AC_MSG_RESULT([$use_openssl])
3989+
3990+AC_ARG_WITH(openssl-includes,
3991+ AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
3992+ [ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
3993+)
3994+
3995+AC_ARG_WITH(openssl-libs,
3996+ AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
3997+ [ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
3998+)
3999+
4000+AC_ARG_WITH(kerberos5,
4001+ AC_HELP_STRING([--with-kerberos5],[use Kerberos5 support with OpenSSL]),
4002+ [ use_kerberos=yes ], [use_kerberos=no]
4003+)
4004+
4005+if test "x$use_openssl" = "xyes"; then
4006+ if test "x$use_kerberos" != "xyes"; then
4007+ CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
4008+ fi
4009+
4010+ AC_CHECK_HEADERS([openssl/ssl.h])
4011+ OLDLIBS="$LIBS"
4012+ AC_CHECK_LIB(crypto, BIO_f_base64, [
4013+ AC_CHECK_LIB(ssl, SSL_new, [ SSL_LIB="-lssl -lcrypto"
4014+ AC_DEFINE(HAVE_LIBSSL, [], [Have libssl]) ], [], [ -lcrypto "$DL_LIB" ])
4015+ ], [], [])
4016+ LIBS="$OLDLIBS"
4017+ AC_SUBST(SSL_LIB)
4018+fi
4019+
4020+AC_MSG_CHECKING(for perl regular expressions support)
4021+AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre],[Enable pcre support (default yes)]),
4022+ [WITH_PCRE=$withval],[WITH_PCRE=yes])
4023+AC_MSG_RESULT([$WITH_PCRE])
4024+
4025+if test "x$cross_compiling" = xno -a "$WITH_PCRE" != "no"; then
4026+ AC_PATH_PROG(PCRECONFIG, pcre-config)
4027+
4028+ if test x"$PCRECONFIG" != x; then
4029+ PCRE_LIB=`$PCRECONFIG --libs`
4030+ CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
4031+ AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
4032+ AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
4033+ else
4034+ AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
4035+ fi
4036+fi
4037+
4038+AC_SUBST(PCRE_LIB)
4039+
4040+AC_MSG_CHECKING(for zlib support)
4041+AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],[Enable zlib support for mod_compress]),
4042+ [WITH_ZLIB=$withval],[WITH_ZLIB=yes])
4043+AC_MSG_RESULT([$WITH_ZLIB])
4044+
4045+if test "$WITH_ZLIB" != "no"; then
4046+ AC_CHECK_LIB(z, deflate, [
4047+ AC_CHECK_HEADERS([zlib.h],[
4048+ Z_LIB=-lz
4049+ AC_DEFINE([HAVE_LIBZ], [1], [libz])
4050+ AC_DEFINE([HAVE_ZLIB_H], [1])
4051+ ])
4052+ ])
4053+ if test x$Z_LIB = x; then
4054+ AC_MSG_ERROR([zlib-headers and/or libs where not found, install them or build with --without-zlib])
4055+ fi
4056+fi
4057+AC_SUBST(Z_LIB)
4058+
4059+AC_MSG_CHECKING(for bzip2 support)
4060+AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2],[Enable bzip2 support for mod_compress]),
4061+ [WITH_BZIP2=$withval],[WITH_BZIP2=yes])
4062+AC_MSG_RESULT([$WITH_BZIP2])
4063+
4064+if test "$WITH_BZIP2" != "no"; then
4065+ AC_CHECK_LIB(bz2, BZ2_bzCompress, [
4066+ AC_CHECK_HEADERS([bzlib.h],[
4067+ BZ_LIB=-lbz2
4068+ AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
4069+ AC_DEFINE([HAVE_BZLIB_H], [1])
4070+ ])
4071+ ])
4072+ if test x$BZ_LIB = x; then
4073+ AC_MSG_ERROR([bzip2-headers and/or libs where not found, install them or build with --without-bzip2])
4074+ fi
4075+fi
4076+AC_SUBST(BZ_LIB)
4077+
4078+if test -z "$PKG_CONFIG"; then
4079+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
4080+fi
4081+
4082+dnl Check for gamin
4083+AC_MSG_CHECKING(for FAM)
4084+AC_ARG_WITH(fam, AC_HELP_STRING([--with-fam],[fam/gamin for reducing number of stat() calls]),
4085+[WITH_FAM=$withval],[WITH_FAM=no])
4086+AC_MSG_RESULT([$WITH_FAM])
4087+
4088+if test "$WITH_FAM" != "no"; then
4089+ AC_CHECK_LIB(fam, FAMOpen2, [
4090+ AC_CHECK_HEADERS([fam.h],[
4091+ FAM_LIBS=-lfam
4092+ AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
4093+ AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
4094+ ])
4095+ ])
4096+ if test "x$FAM_LIBS" = x; then
4097+ PKG_CHECK_MODULES(FAM, gamin >= 0.1.0, [
4098+ AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
4099+ AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
4100+ ])
4101+ fi
4102+ OLD_LIBS=$LIBS
4103+ LIBS=$FAM_LIBS
4104+ AC_CHECK_FUNCS([FAMNoExists])
4105+ LIBS=$OLD_LIBS
4106+
4107+ if test x$FAM_LIBS = x; then
4108+ AC_MSG_ERROR([fam/gamin-headers and/or libs where not found, install them or build with --without-fam])
4109+ fi
4110+fi
4111+
4112+AC_MSG_CHECKING(for properties in mod_webdav)
4113+AC_ARG_WITH(webdav-props, AC_HELP_STRING([--with-webdav-props],[properties in mod_webdav]),
4114+[WITH_WEBDAV_PROPS=$withval],[WITH_WEBDAV_PROPS=no])
4115+AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
4116+
4117+if test "$WITH_WEBDAV_PROPS" != "no"; then
4118+ PKG_CHECK_MODULES(XML, libxml-2.0, [
4119+ AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
4120+ AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
4121+ ])
4122+ PKG_CHECK_MODULES(SQLITE, sqlite3, [
4123+ AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
4124+ AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
4125+ ])
4126+
4127+ AC_MSG_CHECKING(for locks in mod_webdav)
4128+ AC_ARG_WITH(webdav-locks, AC_HELP_STRING([--with-webdav-locks],[locks in mod_webdav]),
4129+ [WITH_WEBDAV_LOCKS=$withval],[WITH_WEBDAV_LOCKS=no])
4130+ AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
4131+
4132+ if test "$WITH_WEBDAV_LOCKS" != "no"; then
4133+ AC_CHECK_LIB(uuid, uuid_unparse, [
4134+ AC_CHECK_HEADERS([uuid/uuid.h],[
4135+ UUID_LIBS=-luuid
4136+ AC_DEFINE([HAVE_UUID], [1], [libuuid])
4137+ AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
4138+ ])
4139+ ])
4140+
4141+ fi
4142+fi
4143+AC_SUBST(UUID_LIBS)
4144+
4145+dnl Check for gdbm
4146+AC_MSG_CHECKING(for gdbm)
4147+AC_ARG_WITH(gdbm, AC_HELP_STRING([--with-gdbm],[gdbm storage for mod_trigger_b4_dl]),
4148+[WITH_GDBM=$withval],[WITH_GDBM=no])
4149+AC_MSG_RESULT([$WITH_GDBM])
4150+
4151+if test "$WITH_GDBM" != "no"; then
4152+ AC_CHECK_LIB(gdbm, gdbm_open, [
4153+ AC_CHECK_HEADERS([gdbm.h],[
4154+ GDBM_LIB=-lgdbm
4155+ AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
4156+ AC_DEFINE([HAVE_GDBM_H], [1])
4157+ ])
4158+ ])
4159+ AC_SUBST(GDBM_LIB)
4160+fi
4161+
4162+dnl Check for memcache
4163+AC_MSG_CHECKING(for memcache)
4164+AC_ARG_WITH(memcache, AC_HELP_STRING([--with-memcache],[memcached storage for mod_trigger_b4_dl]),
4165+[WITH_MEMCACHE=$withval],[WITH_MEMCACHE=no])
4166+AC_MSG_RESULT([$WITH_MEMCACHE])
4167+if test "$WITH_MEMCACHE" != "no"; then
4168+ AC_CHECK_LIB(memcache, mc_new, [
4169+ AC_CHECK_HEADERS([memcache.h],[
4170+ MEMCACHE_LIB=-lmemcache
4171+ AC_DEFINE([HAVE_MEMCACHE], [1], [libmemcache])
4172+ AC_DEFINE([HAVE_MEMCACHE_H], [1], [memcache.h])
4173+ ])
4174+ ])
4175+ AC_SUBST(MEMCACHE_LIB)
4176+fi
4177+
4178+dnl Check for lua
4179+AC_MSG_CHECKING(if lua-support is requested)
4180+AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua engine for mod_cml]),
4181+[WITH_LUA=$withval],[WITH_LUA=no])
4182+
4183+AC_MSG_RESULT($WITH_LUA)
4184+if test "$WITH_LUA" != "no"; then
4185+ if test "$WITH_LUA" = "yes"; then
4186+ WITH_LUA=lua
4187+ fi
4188+ PKG_CHECK_MODULES(LUA, $WITH_LUA >= 5.1, [
4189+ AC_DEFINE([HAVE_LUA], [1], [liblua])
4190+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
4191+ ],[
4192+ # for debian based systems
4193+ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
4194+ AC_DEFINE([HAVE_LUA], [1], [liblua])
4195+ AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
4196+ ])
4197+ ])
4198+
4199+ AC_SUBST(LUA_CFLAGS)
4200+ AC_SUBST(LUA_LIBS)
4201+fi
4202+
4203+save_LIBS=$LIBS
4204+AC_SEARCH_LIBS(crypt,crypt,[
4205+ AC_CHECK_HEADERS([crypt.h],[
4206+ AC_DEFINE([HAVE_CRYPT_H], [1])
4207+ ])
4208+
4209+ AC_DEFINE([HAVE_LIBCRYPT], [1], [libcrypt])
4210+ if test "$ac_cv_search_crypt" != no; then
4211+ test "$ac_cv_search_crypt" = "none required" || CRYPT_LIB="$ac_cv_search_crypt"
4212+ fi
4213+])
4214+LIBS=$save_LIBS
4215+AC_SUBST(CRYPT_LIB)
4216+
4217+save_LIBS=$LIBS
4218+AC_SEARCH_LIBS(sendfilev,sendfile,[
4219+ if test "$ac_cv_search_sendfilev" != no; then
4220+ test "$ac_cv_search_sendfilev" = "none required" || SENDFILE_LIB="$ac_cv_search_sendfilev"
4221+ AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
4222+ fi
4223+])
4224+LIBS=$save_LIBS
4225+AC_SUBST(SENDFILE_LIB)
4226+
4227+case $host_os in
4228+ *mingw* ) LIBS="$LIBS -lwsock32";;
4229+ * ) ;;
4230+esac
4231+
4232+AC_CHECK_FUNCS([dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \
4233+ strdup strerror strstr strtol sendfile getopt socket lstat \
4234+ gethostbyname poll sigtimedwait epoll_ctl getrlimit chroot \
4235+ getuid select signal pathconf madvise posix_fadvise posix_madvise \
4236+ writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r])
4237+
4238+AC_MSG_CHECKING(for Large File System support)
4239+AC_ARG_ENABLE(lfs,
4240+ AC_HELP_STRING([--enable-lfs],[Turn on Large File System (default)]),
4241+ [case "${enableval}" in
4242+ yes) CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" ;;
4243+ no) ;;
4244+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-lfs) ;;
4245+ esac],[CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
4246+ enable_lfs=yes])
4247+AC_MSG_RESULT($enableval)
4248+
4249+AC_CHECK_SIZEOF(long)
4250+AC_CHECK_SIZEOF(off_t)
4251+
4252+if test "x$ac_cv_func_sendfile" = xyes; then
4253+ # check if sendfile works
4254+ AC_MSG_CHECKING(if sendfile works)
4255+ if test "x$cross_compiling" = xno; then
4256+ AC_TRY_RUN([
4257+ #ifdef HAVE_SYS_SENDFILE_H
4258+ #include <sys/sendfile.h>
4259+ #endif /* HAVE_SYS_SENDFILE_H */
4260+ #include <errno.h>
4261+ int main() {
4262+ int o = 0;
4263+ if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
4264+ return 0;
4265+ } ],
4266+ AC_MSG_RESULT(yes),
4267+ [ AC_MSG_RESULT(no)
4268+ AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) ] )
4269+ else
4270+ AC_MSG_RESULT(no, cross-compiling)
4271+ AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
4272+ fi
4273+fi
4274+
4275+dnl Check for IPv6 support
4276+
4277+AC_ARG_ENABLE(ipv6,
4278+ AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
4279+ [case "${enableval}" in
4280+ yes) ipv6=true ;;
4281+ no) ipv6=false ;;
4282+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
4283+ esac],[ipv6=true])
4284+
4285+if test x$ipv6 = xtrue; then
4286+ AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
4287+ [AC_TRY_LINK([ #include <sys/types.h>
4288+#include <sys/socket.h>
4289+#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ],
4290+ [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
4291+
4292+ if test "$ac_cv_ipv6_support" = yes; then
4293+ AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
4294+ fi
4295+fi
4296+
4297+
4298+AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
4299+
4300+dnl check for fastcgi lib, for the tests only
4301+fastcgi_found=no
4302+AC_CHECK_LIB(fcgi, FCGI_Accept, [
4303+ AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h],[
4304+ fastcgi_found=yes
4305+ ])
4306+])
4307+
4308+AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_found" = xyes)
4309+
4310+
4311+# check for extra compiler options (warning options)
4312+if test "${GCC}" = "yes"; then
4313+ CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99"
4314+fi
4315+
4316+AC_ARG_ENABLE(extra-warnings,
4317+ AC_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)]),
4318+ [case "${enableval}" in
4319+ yes) extrawarnings=true ;;
4320+ no) extrawarnings=false ;;
4321+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-warnings) ;;
4322+ esac],[extrawarnings=false])
4323+
4324+if test x$extrawarnings = xtrue; then
4325+ CFLAGS="${CFLAGS} -g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wno-pointer-sign -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed -Wformat-security"
4326+fi
4327+
4328+dnl build version-id
4329+LIGHTTPD_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'`
4330+AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
4331+
4332+AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile \
4333+ tests/docroot/Makefile \
4334+ tests/docroot/123/Makefile \
4335+ tests/docroot/www/Makefile \
4336+ tests/docroot/www/go/Makefile \
4337+ tests/docroot/www/indexfile/Makefile \
4338+ tests/docroot/www/expire/Makefile \
4339+ distribute.sh])
4340+AC_OUTPUT
4341+
4342+
4343+do_build="mod_cgi mod_fastcgi mod_extforward mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_status mod_accesslog"
4344+do_build="$do_build mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfile mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming"
4345+
4346+plugins="mod_rewrite mod_redirect mod_ssi mod_trigger_b4_dl"
4347+features="regex-conditionals"
4348+if test ! "x$PCRE_LIB" = x; then
4349+ do_build="$do_build $plugins"
4350+ enable_feature="$features"
4351+else
4352+ no_build="$no_build $plugins"
4353+ disable_feature="$features"
4354+fi
4355+
4356+plugins="mod_mysql_vhost"
4357+if test ! "x$MYSQL_LIBS" = x; then
4358+ do_build="$do_build $plugins"
4359+else
4360+ no_build="$no_build $plugins"
4361+fi
4362+
4363+plugins="mod_cml mod_magnet"
4364+if test ! "x$LUA_LIBS" = x; then
4365+ do_build="$do_build $plugins"
4366+else
4367+ no_build="$no_build $plugins"
4368+fi
4369+
4370+features="storage-gdbm"
4371+if test ! "x$GDBM_LIB" = x; then
4372+ enable_feature="$enable_feature $features"
4373+else
4374+ disable_feature="$disable_feature $features"
4375+fi
4376+
4377+features="storage-memcache"
4378+if test ! "x$MEMCACHE_LIB" = x; then
4379+ enable_feature="$enable_feature $features"
4380+else
4381+ disable_feature="$disable_feature $features"
4382+fi
4383+
4384+features="compress-gzip compress-deflate"
4385+if test ! "x$Z_LIB" = x; then
4386+ enable_feature="$enable_feature $features"
4387+else
4388+ disable_feature="$disable_feature $features"
4389+fi
4390+
4391+features="compress-bzip2"
4392+if test ! "x$BZ_LIB" = x; then
4393+ enable_feature="$enable_feature $features"
4394+else
4395+ disable_feature="$disable_feature $features"
4396+fi
4397+
4398+features="auth-ldap"
4399+if test ! "x$LDAP_LIB" = x; then
4400+ enable_feature="$enable_feature $features"
4401+else
4402+ disable_feature="$disable_feature $features"
4403+fi
4404+
4405+features="network-openssl"
4406+if test ! "x$SSL_LIB" = x; then
4407+ enable_feature="$enable_feature $features"
4408+else
4409+ disable_feature="$disable_feature $features"
4410+fi
4411+
4412+# no crypt call
4413+features="auth-crypt"
4414+if test "$ac_cv_search_crypt" = no; then
4415+ disable_feature="$disable_feature $features"
4416+else
4417+ enable_feature="$enable_feature $features"
4418+fi
4419+
4420+features="network-ipv6"
4421+if test "$ac_cv_ipv6_support" = yes; then
4422+ enable_feature="$enable_feature $features"
4423+else
4424+ disable_feature="$disable_feature $features"
4425+fi
4426+
4427+features="large-files"
4428+if test "$enable_lfs" = yes; then
4429+ enable_feature="$enable_feature $features"
4430+else
4431+ disable_feature="$disable_feature $features"
4432+fi
4433+
4434+features="stat-cache-fam"
4435+if test ! "x$FAM_LIBS" = x; then
4436+ enable_feature="$enable_feature $features"
4437+else
4438+ disable_feature="$disable_feature $features"
4439+fi
4440+
4441+features="webdav-properties"
4442+if test "x$XML_LIBS" \!= x -a "x$SQLITE_LIBS" \!= x; then
4443+ enable_feature="$enable_feature $features"
4444+else
4445+ disable_feature="$disable_feature $features"
4446+fi
4447+
4448+features="webdav-locks"
4449+if test "x$UUID_LIBS" \!= x; then
4450+ enable_feature="$enable_feature $features"
4451+else
4452+ disable_feature="$disable_feature $features"
4453+fi
4454+
4455+
4456+## output
4457+
4458+$ECHO
4459+$ECHO "Plugins:"
4460+$ECHO
4461+
4462+$ECHO "enabled: "
4463+for p in $do_build; do
4464+ $ECHO " $p"
4465+done | sort
4466+
4467+$ECHO "disabled: "
4468+for p in $no_build; do
4469+ $ECHO " $p"
4470+done | sort
4471+
4472+$ECHO
4473+$ECHO "Features:"
4474+$ECHO
4475+
4476+$ECHO "enabled: "
4477+for p in $enable_feature; do
4478+ $ECHO " $p"
4479+done | sort
4480+
4481+$ECHO "disabled: "
4482+for p in $disable_feature; do
4483+ $ECHO " $p"
4484+done | sort
4485+
4486+$ECHO
cdac2405
ER
4487Index: doc/lighttpd.1
4488===================================================================
b57f094a
ER
4489--- doc/lighttpd.1 (.../tags/lighttpd-1.4.22) (revision 2504)
4490+++ doc/lighttpd.1 (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
4491@@ -1,18 +0,0 @@
4492-.TH LIGHTTPD 1 2003-12-21
4493-.SH NAME
4494-lighttpd - a fast, secure and flexible webserver
4495-.SH SYNOPSIS
4496-lighttpd -D -f <configfile>
4497-.SH DESCRIPTION
4498-.SH FILES
4499-/etc/lighttpd/lighttpd.conf
4500-.SH CONFORMING TO
4501-HTTP/1.0
4502-HTTP/1.0
4503-HTTP-Authentification - Basic, Digest
4504-FastCGI
4505-CGI/1.1
4506-.SH SEE ALSO
4507-spawn-fcgi(1)
4508-.SH AUTHOR
4509-jan@kneschke.de
9ab53fe1
ER
4510Index: doc/spawn-fcgi.1
4511===================================================================
b57f094a
ER
4512--- doc/spawn-fcgi.1 (.../tags/lighttpd-1.4.22) (revision 2504)
4513+++ doc/spawn-fcgi.1 (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
4514@@ -1,13 +0,0 @@
4515-.TH SPAWNFCGI 1 2003-12-21
4516-.SH NAME
4517-spawn-fcgi \- spawning FastCGI processes
4518-.SH SYNOPSIS
4519-spawn-fcgi -f <fastcgi-binary> [-p <port> | -s <socket>] [-C <num-of-php-procs>] [-c <chroot-dir>] [-u <username>] [-g <groupname>]
4520-spawn-fcgi -v
4521-spawn-fcgi -h
4522-.SH DESCRIPTION
4523-spawn-fcgi is used to spawn remote FastCGI processes.
4524-.SH SEE ALSO
4525-lighttpd(1)
4526-.SH AUTHOR
4527-jan@kneschke.de
b57f094a
ER
4528Index: doc/configuration.txt
4529===================================================================
4530--- doc/configuration.txt (.../tags/lighttpd-1.4.22) (revision 2504)
4531+++ doc/configuration.txt (.../branches/lighttpd-1.4.x) (revision 2504)
4532@@ -281,6 +281,12 @@
4533 server.use-ipv6
4534 bind to the IPv6 socket
4535
4536+server.defer-accept
4537+ set TCP_DEFER_ACCEPT to the specified value on the socket if the value is > 0
4538+ and TCP_DEFER_ACCEPT is available on the platform (linux2.4+)
4539+
4540+ default: 0
4541+
4542 server.tag
4543 set the string returned by the Server: response header
4544
cdac2405
ER
4545Index: doc/lighttpd.8
4546===================================================================
4547--- doc/lighttpd.8 (.../tags/lighttpd-1.4.22) (revision 0)
b57f094a 4548+++ doc/lighttpd.8 (.../branches/lighttpd-1.4.x) (revision 2504)
cdac2405
ER
4549@@ -0,0 +1,70 @@
4550+.TH LIGHTTPD "8" "2009-03-07" "" ""
4551+.
4552+.SH NAME
4553+lighttpd \- a fast, secure and flexible web server
4554+.
4555+.SH SYNOPSIS
4556+\fBlighttpd\fP [\fB\-ptDvVh\fP] \fB\-f\fP \fIconfigfile\fP [\fB\-m\fP \fImoduledir\fP]
4557+.
4558+.SH DESCRIPTION
4559+\fBlighttpd\fP (pronounced 'lighty') is an advanced HTTP daemon that aims
4560+to be secure, fast, compliant and very flexible. It has been optimized for
4561+high performance. Its feature set includes, but is not limited to, FastCGI,
4562+CGI, basic and digest HTTP authentication, output compression, URL rewriting.
4563+.PP
4564+This manual page only lists the command line arguments. For details
4565+on how to configure \fBlighttpd\fP and its modules see the files in the
4566+doc-directory.
4567+.
4568+.SH OPTIONS
4569+The following options are supported:
4570+.TP 8
4571+\fB\-f\ \fP \fIconfigfile\fP
4572+Load configuration file \fIconfigfile\fP.
4573+.TP 8
4574+\fB\-m\ \fP \fImoduledir\fP
4575+Use
4576+\fImoduledir\fP
4577+as the directory that contains modules, instead of the default.
4578+.TP 8
4579+\fB\-p\fP
4580+Print the parsed configuration file in its internal form and exit.
4581+.TP 8
4582+\fB\-t\fP
4583+Test the configuration file for syntax errors and exit.
4584+.TP 8
4585+\fB\-D\fP
4586+Do not daemonize (go into background). The default is to daemonize.
4587+.TP 8
4588+\fB\-v\fP
4589+Show version and exit.
4590+.TP 8
4591+\fB\-V\fP
4592+Show compile-time features and exit.
4593+.TP 8
4594+\fB\-h\fP
4595+Show a brief help message and exit.
4596+.
4597+.SH FILES
4598+.TP 8
4599+/etc/lighttpd/lighttpd.conf
4600+The standard location for the configuration file.
4601+.TP 8
4602+/var/run/lighttpd.pid
4603+The standard location for the PID of the running \fBlighttpd\fP process.
4604+.
4605+.SH SEE ALSO
4606+Online Documentation: http://wiki.lighttpd.net/
4607+.PP
4608+spawn-fcgi(1)
4609+.PP
4610+\fIHypertext Transfer Protocol -- HTTP/1.1\fP, RFC 2616.
4611+.PP
4612+\fIHTTP Authentication: Basic and Digest Access Authentication\fP, RFC 2617.
4613+.PP
4614+\fIThe Common Gateway Interface Version 1.1\fP, RFC 3875.
4615+.PP
4616+\fIThe FastCGI specification\fP.
4617+.
4618+.SH AUTHOR
4619+Jan Kneschke <jan@kneschke.de>
b57f094a
ER
4620Index: doc/evhost.txt
4621===================================================================
4622--- doc/evhost.txt (.../tags/lighttpd-1.4.22) (revision 2504)
4623+++ doc/evhost.txt (.../branches/lighttpd-1.4.x) (revision 2504)
4624@@ -33,6 +33,7 @@
4625 %2 => domain name without tld
4626 %3 => subdomain 1 name
4627 %4 => subdomain 2 name
4628+ %_ => the complete hostname (without port info)
4629
4630 evhost.path-pattern = "/home/www/servers/%3/pages/"
4631
4632Index: doc/dirlisting.txt
4633===================================================================
4634--- doc/dirlisting.txt (.../tags/lighttpd-1.4.22) (revision 2504)
4635+++ doc/dirlisting.txt (.../branches/lighttpd-1.4.x) (revision 2504)
4636@@ -80,3 +80,47 @@
4637 Example: ::
4638
4639 dir-listing.encoding = "utf-8"
4640+
4641+dir-listing.show-readme
4642+ shows README.txt after the dirlisting if it exists in the directory
4643+
4644+ Default: disabled
4645+
4646+dir-listing.hide-readme-file
4647+ hides README.txt in the dirlisting
4648+
4649+ Default: disabled
4650+
4651+dir-listing.show-header
4652+ shows HEADER.txt before the dirlisting if it exists in the directory
4653+
4654+ Default: disabled
4655+
4656+dir-listing.hide-header-file
4657+ hides HEADER.txt in the dirlisting
4658+
4659+ Default: disabled
4660+
4661+dir-listing.set-footer
4662+
4663+ Default: empty, uses server.tag instead
4664+
4665+dir-listing.encode-readme
4666+ encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
4667+
4668+ Default: enabled
4669+
4670+dir-listing.encode-header
4671+ encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
4672+
4673+ Default: enabled
4674+
4675+dir-listing.auto-layout
4676+ Disable this if you want your own html header and footer; specify
4677+ them in HEADER.txt and README.txt
4678+
4679+ you have to enable dir-list.show-readme/header for this of course
4680+
4681+ .external-css and .set-footer will be ignored if this is disabled
4682+
4683+ Default: enabled
9ab53fe1
ER
4684Index: doc/lighttpd.conf
4685===================================================================
b57f094a
ER
4686--- doc/lighttpd.conf (.../tags/lighttpd-1.4.22) (revision 2504)
4687+++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1
ER
4688@@ -16,7 +16,6 @@
4689 # "mod_redirect",
4690 # "mod_alias",
4691 "mod_access",
4692-# "mod_cml",
4693 # "mod_trigger_b4_dl",
4694 # "mod_auth",
4695 # "mod_status",
4696@@ -35,8 +34,8 @@
4697 # "mod_rrdtool",
4698 "mod_accesslog" )
4699
4700-## a static document-root, for virtual-hosting take look at the
4701-## server.virtual-* options
4702+## A static document-root. For virtual hosting take a look at the
4703+## mod_simple_vhost module.
4704 server.document-root = "/srv/www/htdocs/"
4705
4706 ## where to send error-messages to
4707@@ -299,11 +298,6 @@
4708 # trigger-before-download.deny-url = "http://127.0.0.1/index.html"
4709 # trigger-before-download.trigger-timeout = 10
4710
4711-## for mod_cml
4712-## don't forget to add index.cml to server.indexfiles
4713-# cml.extension = ".cml"
4714-# cml.memcache-hosts = ( "127.0.0.1:11211" )
4715-
4716 #### variable usage:
4717 ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
4718 #bar = 1
b57f094a
ER
4719Index: doc/extforward.txt
4720===================================================================
4721--- doc/extforward.txt (.../tags/lighttpd-1.4.22) (revision 2504)
4722+++ doc/extforward.txt (.../branches/lighttpd-1.4.x) (revision 2504)
4723@@ -49,11 +49,20 @@
4724 Default: empty
4725
4726 Example: ::
4727-
4728+
4729 extforward.forwarder = ("10.0.0.232" => "trust")
4730
4731- will translate ip addresses coming from 10.0.0.232 to real ip addresses extracted from X-Forwarded-For: HTTP request header.
4732+ will translate ip addresses coming from 10.0.0.232 to real ip addresses extracted from "X-Forwarded-For" or "Forwarded-For" HTTP request header.
4733
4734+extforward.headers
4735+ Sets headers to search for finding the originl addresses.
4736+
4737+ Example (for use with a Zeus ZXTM loadbalancer): ::
4738+
4739+ extforward.headers = ("X-Cluster-Client-Ip")
4740+
4741+ Default: empty, results in searching for "X-Forwarded-For" and "Forwarded-For"
4742+
4743 Note
4744 =======
4745
cdac2405
ER
4746Index: doc/Makefile.am
4747===================================================================
b57f094a
ER
4748--- doc/Makefile.am (.../tags/lighttpd-1.4.22) (revision 2504)
4749+++ doc/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2504)
9ab53fe1 4750@@ -1,6 +1,5 @@
cdac2405 4751-dist_man1_MANS=lighttpd.1 spawn-fcgi.1
cdac2405
ER
4752+dist_man8_MANS=lighttpd.8
4753
4754-
4755 DOCS=accesslog.txt \
4756 authentication.txt \
4757 cgi.txt \
1e1cc0d1
ER
4758Index: SConstruct
4759===================================================================
cc1350fa
ER
4760Index: NEWS
4761===================================================================
b57f094a
ER
4762--- NEWS (.../tags/lighttpd-1.4.22) (revision 2504)
4763+++ NEWS (.../branches/lighttpd-1.4.x) (revision 2504)
4764@@ -3,7 +3,45 @@
cc1350fa
ER
4765 NEWS
4766 ====
4767
cdac2405
ER
4768-- 1.4.22 -
4769+- 1.4.23 -
4770+ * Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)
4771+ * New lighttpd man page (moved it to section 8) (fixes #1875)
9ab53fe1
ER
4772+ * Create rrd file for empty rrdfile in mod_rrdtool (#1788)
4773+ * Fix workaround for incorrect path info/scriptname if fastcgi prefix is "/" (fixes #729)
4774+ * Finally removed spawn-fcgi
4775+ * Allow xattr to overwrite mime type (fixes #1929)
4776+ * Remove link from errormsg about fastcgi apps (fixes #1942)
4777+ * Strip trailing dot from "Host:" header
4778+ * Remove the optional port info from SERVER_NAME (thx Mr_Bond)
4779+ * Fix mod_proxy RoundRobin (off by one problem if only one backend is up)
4780+ * Rename configure.in to configure.ac, with small cleanups (fixes #1932)
4781+ * Add proper SUID bit detection (fixes #416)
4782+ * Check for regular file in mod_cgi, so we don't try to start directories
4783+ * Include mmap.h from chunk.h to fix some problems with #define mmap mmap64 (fixes #1923)
4784+ * Add support for pipe logging for server.errorlog (fixes #296)
4785+ * Add revision number to package version for svn/git checkouts
4786+ * Use server.tag for SERVER_SOFTWARE if configured (fixes #357)
4787+ * Fix trailing zero char in REQUEST_URI after "strip-request-uri" in mod_fastcgi
4788+ * mod_magnet: Add env["request.remote-ip"] (fixes #1740)
4789+ * mod_magnet: Add env["request.path-info"]
4790+ * Change name/version separator back to "/" (affects every place where the version is printed)
b57f094a
ER
4791+ * Fix bug with FastCGI request id overflow under high load; just use always id 1 as we don't use multiplexing. (thx jgray)
4792+ * Add some dirlisting enhancements (fixes #1458)
4793+ * Add option to enable TCP_DEFER_ACCEPT (fixes #1447)
4794+ * Limit amount of bytes read for one read-event (fixes #1070)
4795+ * Add evasive.silent option (fixes #1438)
4796+ * Make mod_extforward headers configurable (fixes #1545)
4797+ * Add '%_' pattern for complete hostname in mod_evhost (fixes #1737)
4798+ * Add IPv6 support to mod_proxy (fixes #1537)
4799+ * mod_ssi printenv: print cgi env, add environment vars to cgi env (fixes #1713)
4800+ * Fix error message if no auth backend was set
4801+ * Fix SERVER_NAME port stripping (fixes #1968)
4802+ * Fix x-sendfile 2gb limiting (fixes #1970)
4803+ * Fix mod_cgi environment keys mangling (fixes #1969)
4804+ * Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)
4805+ * Fix max-age value in mod_expire for 'modification' (fixes #1978)
709c1a0b 4806+
cdac2405
ER
4807+- 1.4.22 - 2009-03-07
4808 * Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)
4809 * Fix default vhost in mod_simple_vhost (fixes #1905)
4810 * Handle EINTR in mod_rrdtool (fixes #604)
170f212a
ER
4811Index: CMakeLists.txt
4812===================================================================
a34aaa25
ER
4813
4814Property changes on: .
4815___________________________________________________________________
709c1a0b 4816Modified: bzr:revision-info
cdac2405 4817 - timestamp: 2009-03-07 14:58:05.338000059 +0100
54b68997
ER
4818committer: Stefan Bühler <stbuehler@web.de>
4819properties:
4820 branch-nick: lighttpd-1.4.x
4821
cdac2405 4822 + timestamp: 2009-03-07 22:04:32.213999987 +0100
709c1a0b
ER
4823committer: Stefan Bühler <stbuehler@web.de>
4824properties:
4825 branch-nick: lighttpd-1.4.x
4826
cdac2405
ER
4827Modified: bzr:file-ids
4828 -
4829 + doc/lighttpd.8 lighttpd.8-20090307205615-mc312p5ocjwthwte-1
4830
709c1a0b
ER
4831Modified: bzr:revision-id:v3-trunk0
4832 - 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
48331128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
48341129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
48351130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
48361131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
48371132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
48381133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
48391134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
48401135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
48411136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
48421137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
48431138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
48441139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
48451140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
48461141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
48471142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
48481143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
48491144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
48501145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
48511146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
48521147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
48531148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
48541149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
48551150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
48561151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
48571152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
48581153 stbuehler@web.de-20080812194728-fupt781o6q058unh
48591154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
48601155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
48611156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
48621157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
48631158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
48641159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
48651160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
48661161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
48671162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
48681163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
48691164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
48701165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
48711166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
48721167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
48731168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
48741169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
48751170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
48761171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
48771172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
48781173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
48791174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
48801175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
acde7ead
ER
48811176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
48821177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
48831178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
48841179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
48851180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
48861181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
48871182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
48881183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
48891184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
48901185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
48911186 stbuehler@web.de-20081001200802-l5og517etnneitk0
48921188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
48931189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
48941191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
48951192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
48961193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
48971195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
48981196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
48991197 stbuehler@web.de-20081016121114-65quosenmso8frf8
49001198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
49011199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
49021200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
49031201 stbuehler@web.de-20081205233903-708beaujtf26gprx
49041202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
49051203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
49061204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
49071205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
49081206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
49091208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
49101209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
49111210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
49121211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
49131212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
49141213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
49151214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
49161215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
49171216 stbuehler@web.de-20090205105134-6i5key9439wspueq
49181217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
49191218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
49201219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
49211220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
49221221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
49231222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
49241223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
cdac2405
ER
49251224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
49261225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
49271226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
49281227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
49291228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
49301229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
49311230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
49321231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
49331232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
49341233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
49351234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
49361235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
49371236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
709c1a0b 4938
54b68997
ER
4939 + 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
49401128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
49411129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
49421130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
49431131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
49441132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
49451133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
49461134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
49471135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
49481136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
49491137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
49501138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
49511139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
49521140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
49531141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
49541142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
49551143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
49561144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
49571145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
49581146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
49591147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
49601148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
49611149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
49621150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
49631151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
49641152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
49651153 stbuehler@web.de-20080812194728-fupt781o6q058unh
49661154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
49671155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
49681156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
49691157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
49701158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
49711159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
49721160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
49731161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
49741162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
49751163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
49761164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
49771165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
49781166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
49791167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
49801168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
49811169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
49821170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
709c1a0b
ER
49831171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
49841172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
49851173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
49861174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
49871175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
49881176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
49891177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
49901178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
49911179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
49921180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
49931181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
49941182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
49951183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
49961184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
49971185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
49981186 stbuehler@web.de-20081001200802-l5og517etnneitk0
2ed0f534
ER
49991188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
50001189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
50011191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
170f212a
ER
50021192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
50031193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
50041195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
50051196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
50061197 stbuehler@web.de-20081016121114-65quosenmso8frf8
50071198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
50081199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
50091200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
50101201 stbuehler@web.de-20081205233903-708beaujtf26gprx
50111202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
50121203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
50131204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
50141205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
50151206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
738baab9
ER
50161208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
50171209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
50181210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
50191211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
50201212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
50211213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
50221214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
50231215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
50241216 stbuehler@web.de-20090205105134-6i5key9439wspueq
50251217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
50261218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
25fbab93
ER
50271219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
50281220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
50291221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
acde7ead
ER
50301222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
50311223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
50321224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
50331225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
50341226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
cdac2405
ER
50351227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
50361228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
50371229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
50381230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
50391231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
50401232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
50411233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
50421234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
50431235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
50441236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
50451237 stbuehler@web.de-20090307154555-xybvl7sxrha6vhds
50461238 stbuehler@web.de-20090307204326-10m0681831yvhi3k
50471239 stbuehler@web.de-20090307204846-seq3cmzn6dy9927i
50481240 stbuehler@web.de-20090307205519-ha3s58fcum106yl0
50491241 stbuehler@web.de-20090307210432-jdlv5pp9m519vyv2
54b68997 5050
a34aaa25 5051
This page took 0.89645 seconds and 4 git commands to generate.