2 ===================================================================
3 Index: src/spawn-fcgi.c
4 ===================================================================
5 --- src/spawn-fcgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
6 +++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
8 -#include <sys/types.h>
10 -#include <sys/stat.h>
33 -#define FCGI_LISTENSOCK_FILENO 0
35 -#include "sys-socket.h"
37 -#ifdef HAVE_SYS_WAIT_H
38 -#include <sys/wait.h>
41 -/* for solaris 2.5 and netbsd 1.3.x */
42 -#ifndef HAVE_SOCKLEN_T
43 -typedef int socklen_t;
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) {
49 - int socket_type, status, rc = 0;
50 - struct timeval tv = { 0, 100 * 1000 };
52 - struct sockaddr_un fcgi_addr_un;
53 - struct sockaddr_in fcgi_addr_in;
54 - struct sockaddr *fcgi_addr;
58 - if (child_count < 2) {
62 - if (child_count > 256) {
68 - memset(&fcgi_addr_un, 0, sizeof(fcgi_addr_un));
70 - fcgi_addr_un.sun_family = AF_UNIX;
71 - strcpy(fcgi_addr_un.sun_path, unixsocket);
74 - servlen = SUN_LEN(&fcgi_addr_un);
77 - servlen = strlen(fcgi_addr_un.sun_path) + sizeof(fcgi_addr_un.sun_family);
79 - socket_type = AF_UNIX;
80 - fcgi_addr = (struct sockaddr *) &fcgi_addr_un;
82 - memset(&fcgi_addr_in, 0, sizeof(fcgi_addr_in));
83 - fcgi_addr_in.sin_family = AF_INET;
85 - fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
87 - fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
89 - fcgi_addr_in.sin_port = htons(port);
90 - servlen = sizeof(fcgi_addr_in);
92 - socket_type = AF_INET;
93 - fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
96 - if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
97 - fprintf(stderr, "%s.%d\n",
98 - __FILE__, __LINE__);
102 - if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {
103 - /* server is not up, spawn in */
107 - if (unixsocket) unlink(unixsocket);
111 - /* reopen socket */
112 - if (-1 == (fcgi_fd = socket(socket_type, SOCK_STREAM, 0))) {
113 - fprintf(stderr, "%s.%d\n",
114 - __FILE__, __LINE__);
119 - if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
120 - fprintf(stderr, "%s.%d\n",
121 - __FILE__, __LINE__);
125 - /* create socket */
126 - if (-1 == bind(fcgi_fd, fcgi_addr, servlen)) {
127 - fprintf(stderr, "%s.%d: bind failed: %s\n",
128 - __FILE__, __LINE__,
133 - if (-1 == listen(fcgi_fd, 1024)) {
134 - fprintf(stderr, "%s.%d: fd = -1\n",
135 - __FILE__, __LINE__);
139 - while (fork_count-- > 0) {
149 - char cgi_childs[64];
154 - /* loose control terminal */
157 - /* is safe as we limit to 256 childs */
158 - sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
160 - if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
161 - close(FCGI_LISTENSOCK_FILENO);
162 - dup2(fcgi_fd, FCGI_LISTENSOCK_FILENO);
166 - max_fd = open("/dev/null", O_RDWR);
167 - close(STDERR_FILENO);
168 - dup2(max_fd, STDERR_FILENO);
171 - max_fd = open("/dev/null", O_RDWR);
172 - close(STDOUT_FILENO);
173 - dup2(max_fd, STDOUT_FILENO);
176 - /* we don't need the client socket */
177 - for (i = 3; i < max_fd; i++) {
178 - if (i != FCGI_LISTENSOCK_FILENO) close(i);
181 - /* create environment */
183 - putenv(cgi_childs);
185 - /* fork and replace shell */
187 - execv(appArgv[0], appArgv);
190 - char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
191 - strcpy(b, "exec ");
192 - strcat(b, appPath);
195 - execl("/bin/sh", "sh", "-c", b, (char *)NULL);
209 - select(0, NULL, NULL, NULL, &tv);
211 - switch (waitpid(child, &status, WNOHANG)) {
213 - fprintf(stdout, "%s.%d: child spawned successfully: PID: %d\n",
214 - __FILE__, __LINE__,
217 - /* write pid file */
218 - if (pid_fd != -1) {
219 - /* assume a 32bit pid_t */
222 - snprintf(pidbuf, sizeof(pidbuf) - 1, "%d", child);
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);
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__,
245 - fprintf(stderr, "%s.%d: child died somehow: %d\n",
246 - __FILE__, __LINE__,
258 - fprintf(stderr, "%s.%d: socket is already used, can't spawn\n",
259 - __FILE__, __LINE__);
269 -void show_version () {
270 - char *b = "spawn-fcgi" "-" PACKAGE_VERSION \
271 -" - spawns fastcgi processes\n"
273 - write(1, b, strlen(b));
278 -"Usage: spawn-fcgi [options] -- <fcgiapp> [fcgi app arguments]\n" \
280 -"spawn-fcgi v" PACKAGE_VERSION " - spawns fastcgi processes\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" \
294 -" -c <dir> chroot to directory\n" \
295 -" -u <user> change to user-id\n" \
296 -" -g <group> change to group-id\n" \
298 - write(1, b, strlen(b));
302 -int main(int argc, char **argv) {
303 - char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
304 - *groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
306 - char **fcgi_app_argv = { NULL };
307 - unsigned short port = 0;
308 - int child_count = 5;
309 - int fork_count = 1;
313 - struct sockaddr_un un;
315 - i_am_root = (getuid() == 0);
317 - while (-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:F:s:P:"))) {
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;
338 - if (optind < argc) {
339 - fcgi_app_argv = &argv[optind];
342 - if ((fcgi_app == NULL && fcgi_app_argv == NULL) || (port == 0 && unixsocket == NULL)) {
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");
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");
364 - if (!i_am_root && (geteuid() == 0 || getegid() == 0)) {
365 - /* we are setuid-root */
367 - fprintf(stderr, "%s.%d: %s\n",
368 - __FILE__, __LINE__,
369 - "Are you nuts ? Don't apply a SUID bit to this binary\n");
375 - (-1 == (pid_fd = open(pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)))) {
377 - if (errno != EEXIST) {
378 - fprintf(stderr, "%s.%d: opening pid-file '%s' failed: %s\n",
379 - __FILE__, __LINE__,
380 - pid_file, strerror(errno));
385 - /* ok, file exists */
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));
395 - /* is it a regular file ? */
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__,
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));
415 - struct group *grp = NULL;
416 - struct passwd *pwd = NULL;
418 - /* set user and group */
421 - if (NULL == (pwd = getpwnam(username))) {
422 - fprintf(stderr, "%s.%d: %s, %s\n",
423 - __FILE__, __LINE__,
424 - "can't find username", username);
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");
437 - if (NULL == (grp = getgrnam(groupname))) {
438 - fprintf(stderr, "%s.%d: %s %s\n",
439 - __FILE__, __LINE__,
440 - "can't find groupname",
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");
451 - /* do the change before we do the chroot() */
452 - setgid(grp->gr_gid);
453 - setgroups(0, NULL);
456 - initgroups(username, grp->gr_gid);
462 - if (-1 == chroot(changeroot)) {
463 - fprintf(stderr, "%s.%d: %s %s\n",
464 - __FILE__, __LINE__,
465 - "chroot failed: ", strerror(errno));
468 - if (-1 == chdir("/")) {
469 - fprintf(stderr, "%s.%d: %s %s\n",
470 - __FILE__, __LINE__,
471 - "chdir failed: ", strerror(errno));
476 - /* drop root privs */
478 - setuid(pwd->pw_uid);
482 - return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, fork_count, child_count, pid_fd, nofork);
489 Index: src/configfile-glue.c
490 ===================================================================
491 --- src/configfile-glue.c (.../tags/lighttpd-1.4.22) (revision 2504)
492 +++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2504)
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);
503 return config_insert_values_internal(srv, ca, cv);
506 -unsigned short sock_addr_get_port(sock_addr *addr) {
507 +static unsigned short sock_addr_get_port(sock_addr *addr) {
509 return ntohs(addr->plain.sa_family ? addr->ipv6.sin6_port : addr->ipv4.sin_port);
512 ===================================================================
513 --- src/mod_cgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
514 +++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
519 +#include "stat_cache.h"
520 #include "keyvalue.h"
522 #include "connections.h"
524 # include <sys/filio.h>
527 +#include "version.h"
529 enum {EOL_UNSET, EOL_N, EOL_RN};
532 @@ -696,11 +699,11 @@
534 if (!key || !val) return -1;
536 - dst = malloc(key_len + val_len + 3);
537 + dst = malloc(key_len + val_len + 2);
538 memcpy(dst, key, 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';
545 if (env->size == 0) {
547 @@ -776,25 +779,23 @@
549 close(to_cgi_fds[1]);
552 - * this is not nice, but it works
554 - * we feed the stderr of the CGI to our errorlog, if possible
556 - if (srv->errorlog_mode == ERRORLOG_FILE) {
557 - close(STDERR_FILENO);
558 - dup2(srv->errorlog_fd, STDERR_FILENO);
561 /* create environment */
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));
570 + cgi_env_add(&env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag));
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;
579 + cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
582 s = inet_ntop(srv_sock->addr.plain.sa_family,
584 buffer_prepare_append(p->tmp_buf, ds->key->used + 2);
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]) : '_';
591 + if (light_isalpha(ds->key->ptr[j])) {
593 + cr = ds->key->ptr[j] & ~32;
594 + } else if (light_isdigit(ds->key->ptr[j])) {
596 + cr = ds->key->ptr[j];
598 + p->tmp_buf->ptr[p->tmp_buf->used++] = cr;
600 p->tmp_buf->ptr[p->tmp_buf->used++] = '\0';
602 @@ -1203,6 +1210,7 @@
604 plugin_data *p = p_d;
605 buffer *fn = con->physical.path;
606 + stat_cache_entry *sce = NULL;
608 if (con->mode != DIRECT) return HANDLER_GO_ON;
610 @@ -1210,6 +1218,9 @@
612 mod_cgi_patch_connection(srv, con, p);
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;
617 s_len = fn->used - 1;
619 for (k = 0; k < p->conf.cgi->used; k++) {
620 @@ -1369,6 +1380,7 @@
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");
629 ===================================================================
630 --- src/mod_cml.c (.../tags/lighttpd-1.4.22) (revision 2504)
631 +++ src/mod_cml.c (.../branches/lighttpd-1.4.x) (revision 2504)
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) {
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");
649 Index: src/mod_secure_download.c
650 ===================================================================
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)
654 * @return if the supplied string is a valid MD5 string 1 is returned otherwise 0
657 -int is_hex_len(const char *str, size_t len) {
658 +static int is_hex_len(const char *str, size_t len) {
661 if (NULL == str) return 0;
664 /* this function is called at dlopen() time and inits the callbacks */
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");
671 ===================================================================
672 --- src/base.h (.../tags/lighttpd-1.4.22) (revision 2504)
673 +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2504)
674 @@ -183,11 +183,15 @@
679 + buffer *scheme; /* scheme without colon or slashes ( "http" or "https" ) */
681 + /* authority with optional portnumber ("site.name" or "site.name:8080" ) NOTE: without "username:password@" */
684 + /* path including leading slash ("/" or "/index.html") - urldecoded, and sanitized ( buffer_path_simplify() && buffer_urldecode_path() ) */
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" ) */
694 unsigned short ssl_use_sslv2;
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;
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;
709 fdevents *ev, *ev_ins;
710 Index: src/mod_rewrite.c
711 ===================================================================
712 --- src/mod_rewrite.c (.../tags/lighttpd-1.4.22) (revision 2504)
713 +++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2504)
718 -rewrite_rule_buffer *rewrite_rule_buffer_init(void) {
719 +static rewrite_rule_buffer *rewrite_rule_buffer_init(void) {
720 rewrite_rule_buffer *kvb;
722 kvb = calloc(1, sizeof(*kvb));
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) {
736 -void rewrite_rule_buffer_free(rewrite_rule_buffer *kvb) {
737 +static void rewrite_rule_buffer_free(rewrite_rule_buffer *kvb) {
742 return HANDLER_GO_ON;
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");
749 Index: src/connections.c
750 ===================================================================
751 --- src/connections.c (.../tags/lighttpd-1.4.22) (revision 2504)
752 +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2504)
755 static int connection_handle_read_ssl(server *srv, connection *con) {
757 - int r, ssl_err, len;
758 + int r, ssl_err, len, count = 0;
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 */
765 chunkqueue_append_buffer_weak(con->read_queue, b);
767 con->bytes_read += len;
771 + } while (len > 0 && count < MAX_READ_LIMIT);
776 b = chunkqueue_get_append_buffer(con->read_queue);
777 buffer_prepare_copy(b, 4 * 1024);
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);
785 * we get called by the state-engine and by the fdevent-handler
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;
792 @@ -1156,7 +1158,7 @@
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;
801 Index: src/mod_staticfile.c
802 ===================================================================
803 --- src/mod_staticfile.c (.../tags/lighttpd-1.4.22) (revision 2504)
804 +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2504)
807 /* this function is called at dlopen() time and inits the callbacks */
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");
813 Index: src/mod_alias.c
814 ===================================================================
815 --- src/mod_alias.c (.../tags/lighttpd-1.4.22) (revision 2504)
816 +++ src/mod_alias.c (.../branches/lighttpd-1.4.x) (revision 2504)
819 /* this function is called at dlopen() time and inits the callbacks */
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");
826 ===================================================================
827 --- src/network.c (.../tags/lighttpd-1.4.22) (revision 2504)
828 +++ src/network.c (.../branches/lighttpd-1.4.x) (revision 2504)
830 # include <openssl/rand.h>
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;
839 return HANDLER_GO_ON;
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) {
846 server_socket *srv_socket;
848 int is_unix_domain_socket = 0;
851 -#ifdef SO_ACCEPTFILTER
852 - struct accept_filter_arg afa;
856 WORD wVersionRequested;
858 @@ -396,12 +392,17 @@
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));
870 #ifdef SO_ACCEPTFILTER
872 - * FreeBSD accf_http filter
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) {
880 Index: 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)
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 },
894 s->ssl_use_sslv2 = 0;
896 + s->defer_accept = 0;
898 s->follow_symlink = 1;
902 cv[7].destination = s->server_tag;
903 cv[8].destination = &(s->use_ipv6);
904 + cv[54].destination = &(s->defer_accept);
908 Index: src/mod_trigger_b4_dl.c
909 ===================================================================
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)
914 /* this function is called at dlopen() time and inits the callbacks */
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");
920 Index: src/mod_evhost.c
921 ===================================================================
922 --- src/mod_evhost.c (.../tags/lighttpd-1.4.22) (revision 2504)
923 +++ src/mod_evhost.c (.../branches/lighttpd-1.4.x) (revision 2504)
925 * # %2 => domain name without tld
926 * # %3 => subdomain 1 name
927 * # %4 => subdomain 2 name
928 + * # %_ => fqdn (without port info)
930 * evhost.path-pattern = "/home/ckruse/dev/www/%3/htdocs/"
932 @@ -154,11 +155,12 @@
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
941 - * - %2 - domain.tld
948 static int mod_evhost_parse_host(connection *con,array *host) {
950 if (*(ptr+1) == '%') {
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, ':');
957 + if(colon == NULL) {
958 + buffer_append_string_buffer(p->tmp_buf, con->uri.authority); // adds fqdn
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
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);
967 return HANDLER_GO_ON;
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");
974 Index: src/splaytree.c
975 ===================================================================
976 --- src/splaytree.c (.../tags/lighttpd-1.4.22) (revision 2504)
977 +++ src/splaytree.c (.../branches/lighttpd-1.4.x) (revision 2504)
982 -splay_tree *find_rank(int r, splay_tree *t) {
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, */
996 ===================================================================
997 --- src/lemon.c (.../tags/lighttpd-1.4.22) (revision 2504)
998 +++ src/lemon.c (.../branches/lighttpd-1.4.x) (revision 2504)
1001 extern int access();
1003 +extern char *getenv();
1006 # if defined(_WIN32) || defined(WIN32)
1010 /* #define PRIVATE static */
1012 +#define PRIVATE static
1015 #define MAXRHS 5 /* Set low to exercise exception code */
1018 extern void *malloc();
1020 +extern void memory_error();
1022 /******** From the file "action.h" *************************************/
1023 struct action *Action_new();
1024 struct action *Action_sort();
1028 #define MemoryCheck(X) if((X)==0){ \
1029 - extern void memory_error(); \
1033 @@ -445,14 +447,16 @@
1034 #define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead)
1036 /* Free all memory associated with the given acttab */
1037 -void acttab_free(acttab *p){
1039 +PRIVATE void acttab_free(acttab *p){
1041 free( p->aLookahead );
1046 /* Allocate a new acttab structure */
1047 -acttab *acttab_alloc(void){
1048 +PRIVATE acttab *acttab_alloc(void){
1049 acttab *p = malloc( sizeof(*p) );
1051 fprintf(stderr,"Unable to allocate memory for a new acttab.");
1054 /* Add a new action to the current transaction set
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,
1063 ** Return the offset into the action table of the new transaction.
1065 -int acttab_insert(acttab *p){
1066 +PRIVATE int acttab_insert(acttab *p){
1068 assert( p->nLookahead>0 );
1070 @@ -2603,7 +2607,7 @@
1074 -void ConfigPrint(fp,cfp)
1075 +PRIVATE void ConfigPrint(fp,cfp)
1079 @@ -2640,7 +2644,7 @@
1082 /* Print a plink chain */
1083 -PRIVATE void PlinkPrint(out,plp,tag)
1084 +void PlinkPrint(out,plp,tag)
1088 @@ -2657,7 +2661,7 @@
1089 /* Print an action to the given file descriptor. Return FALSE if
1090 ** nothing was actually printed.
1092 -int PrintAction(struct action *ap, FILE *fp, int indent){
1093 +PRIVATE int PrintAction(struct action *ap, FILE *fp, int indent){
1097 @@ -2731,6 +2735,7 @@
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 @@
1109 - extern int access();
1112 cp = strrchr(argv0,'\\');
1113 @@ -2755,7 +2759,6 @@
1114 if( path ) sprintf(path,"%s/%s",argv0,name);
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
1125 -void emit_destructor_code(out,sp,lemp,lineno)
1126 +PRIVATE void emit_destructor_code(out,sp,lemp,lineno)
1130 @@ -2932,7 +2935,7 @@
1132 ** Return TRUE (non-zero) if the given symbol has a destructor.
1134 -int has_destructor(sp, lemp)
1135 +PRIVATE int has_destructor(sp, lemp)
1139 @@ -3033,7 +3036,7 @@
1140 ** union, also set the ".dtnum" field of every terminal and nonterminal
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 @@
1150 s = (char*)malloc( global_size );
1152 - extern void memory_error();
1155 for(i=0; i<global_size; i++) s[i] = 0;
1157 ===================================================================
1158 --- src/chunk.h (.../tags/lighttpd-1.4.22) (revision 2504)
1159 +++ src/chunk.h (.../branches/lighttpd-1.4.x) (revision 2504)
1164 +#include "sys-mmap.h"
1166 typedef struct chunk {
1167 enum { UNUSED_CHUNK, MEM_CHUNK, FILE_CHUNK } type;
1169 ===================================================================
1170 --- src/etag.c (.../tags/lighttpd-1.4.22) (revision 2504)
1171 +++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 2504)
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]);
1180 buffer_copy_string_len(mut, CONST_STR_LEN("\""));
1181 Index: src/mod_scgi.c
1182 ===================================================================
1183 --- src/mod_scgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
1184 +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
1186 #include <sys/wait.h>
1189 +#include "version.h"
1191 enum {EOL_UNSET, EOL_N, EOL_RN};
1198 -scgi_proc *scgi_process_init() {
1199 +static scgi_proc *scgi_process_init() {
1202 f = calloc(1, sizeof(*f));
1207 -void scgi_process_free(scgi_proc *f) {
1208 +static void scgi_process_free(scgi_proc *f) {
1211 scgi_process_free(f->next);
1216 -scgi_extension_host *scgi_host_init() {
1217 +static scgi_extension_host *scgi_host_init() {
1218 scgi_extension_host *f;
1220 f = calloc(1, sizeof(*f));
1225 -void scgi_host_free(scgi_extension_host *h) {
1226 +static void scgi_host_free(scgi_extension_host *h) {
1229 buffer_free(h->host);
1234 -scgi_exts *scgi_extensions_init() {
1235 +static scgi_exts *scgi_extensions_init() {
1238 f = calloc(1, sizeof(*f));
1243 -void scgi_extensions_free(scgi_exts *f) {
1244 +static void scgi_extensions_free(scgi_exts *f) {
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) {
1257 @@ -1178,7 +1180,7 @@
1261 -void scgi_connection_cleanup(server *srv, handler_ctx *hctx) {
1262 +static void scgi_connection_cleanup(server *srv, handler_ctx *hctx) {
1266 @@ -1281,10 +1283,11 @@
1268 buffer_prepare_append(env, len);
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;
1281 @@ -1461,10 +1464,18 @@
1282 scgi_env_add(p->scgi_env, CONST_STR_LEN("SCGI"), CONST_STR_LEN("1"));
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));
1289 + scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag));
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;
1298 + scgi_env_add(p->scgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
1301 s = inet_ntop(srv_sock->addr.plain.sa_family,
1302 @@ -1915,7 +1926,7 @@
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) {
1311 @@ -2827,7 +2838,11 @@
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 @@
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';
1335 @@ -3105,6 +3116,7 @@
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");
1343 Index: src/mod_mysql_vhost.c
1344 ===================================================================
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)
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");
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");
1363 Index: src/request.c
1364 ===================================================================
1365 --- src/request.c (.../tags/lighttpd-1.4.22) (revision 2504)
1366 +++ src/request.c (.../branches/lighttpd-1.4.x) (revision 2504)
1368 if (host_len == 0) return -1;
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';
1380 + if (host_len == 0) return -1;
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];
1392 -int http_request_split_value(array *vals, buffer *b) {
1393 +static int http_request_split_value(array *vals, buffer *b) {
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;
1406 Index: src/mod_magnet_cache.c
1407 ===================================================================
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)
1412 #include <lauxlib.h>
1414 -script *script_init() {
1415 +static script *script_init() {
1418 sc = calloc(1, sizeof(*sc));
1423 -void script_free(script *sc) {
1424 +static void script_free(script *sc) {
1427 lua_pop(sc->L, 1); /* the function copy */
1428 Index: src/mod_flv_streaming.c
1429 ===================================================================
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)
1434 /* this function is called at dlopen() time and inits the callbacks */
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");
1440 Index: src/mod_rrdtool.c
1441 ===================================================================
1442 --- src/mod_rrdtool.c (.../tags/lighttpd-1.4.22) (revision 2504)
1443 +++ src/mod_rrdtool.c (.../branches/lighttpd-1.4.x) (revision 2504)
1445 return HANDLER_GO_ON;
1448 -int mod_rrd_create_pipe(server *srv, plugin_data *p) {
1449 +static int mod_rrd_create_pipe(server *srv, plugin_data *p) {
1455 static int mod_rrdtool_create_rrd(server *srv, plugin_data *p, plugin_config *s) {
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;
1467 - /* create a new one */
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(
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;
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(
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"));
1518 - return HANDLER_ERROR;
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));
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;
1531 - return HANDLER_ERROR;
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));
1538 - p->resp->used = r;
1539 + return HANDLER_ERROR;
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;
1548 - return HANDLER_ERROR;
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);
1555 + return HANDLER_ERROR;
1558 return HANDLER_GO_ON;
1560 return HANDLER_GO_ON;
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");
1567 Index: src/stat_cache.c
1568 ===================================================================
1569 --- src/stat_cache.c (.../tags/lighttpd-1.4.22) (revision 2504)
1570 +++ src/stat_cache.c (.../branches/lighttpd-1.4.x) (revision 2504)
1571 @@ -595,29 +595,31 @@
1572 if (S_ISREG(st.st_mode)) {
1573 /* determine mimetype */
1574 buffer_reset(sce->content_type);
1576 + if (con->conf.use_xattr) {
1577 + stat_cache_attr_get(sce->content_type, name->ptr);
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;
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;
1591 - if (type->used == 0) continue;
1592 + /* check if the right side is the same */
1593 + if (type->used > name->used) continue;
1595 - /* check if the right side is the same */
1596 - if (type->used > name->used) continue;
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);
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);
1607 - etag_create(sce->etag, &(sce->st), con->etag_flags);
1609 - if (con->conf.use_xattr && buffer_is_empty(sce->content_type)) {
1610 - stat_cache_attr_get(sce->content_type, name->ptr);
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);
1620 Index: src/response.c
1621 ===================================================================
1622 --- src/response.c (.../tags/lighttpd-1.4.22) (revision 2504)
1623 +++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2504)
1627 #include "sys-socket.h"
1628 +#include "version.h"
1630 int http_response_write_header(server *srv, connection *con) {
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);
1641 Index: src/SConscript
1642 ===================================================================
1643 --- src/SConscript (.../tags/lighttpd-1.4.22) (revision 2504)
1644 +++ src/SConscript (.../branches/lighttpd-1.4.x) (revision 2504)
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' ] },
1655 instbin = env.Program(bin_targets, src, LINKFLAGS = bin_linkflags, LIBS= [ env['LIBS'], common_lib, env['LIBDL'] ])
1656 env.Depends(instbin, configparser)
1658 -spawn_fcgi = env.Program("spawn-fcgi", "spawn-fcgi.c")
1660 if env['COMMON_LIB'] == 'bin':
1661 common_lib = instbin[1]
1667 -Default(spawn_fcgi)
1668 -inst += env.Install('${bindir}', spawn_fcgi)
1670 if env['build_dynamic']:
1671 Default(instbin[0], instlib)
1672 inst += env.Install('${sbindir}', instbin[0])
1673 Index: src/mod_cml_funcs.c
1674 ===================================================================
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)
1681 -int f_dir_files_iter(lua_State *L) {
1682 +static int f_dir_files_iter(lua_State *L) {
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)))) {
1693 lua_pushboolean(L, 0);
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)))) {
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)))) {
1713 Index: src/mod_simple_vhost.c
1714 ===================================================================
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)
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");
1725 Index: src/mod_userdir.c
1726 ===================================================================
1727 --- src/mod_userdir.c (.../tags/lighttpd-1.4.22) (revision 2504)
1728 +++ src/mod_userdir.c (.../branches/lighttpd-1.4.x) (revision 2504)
1731 /* this function is called at dlopen() time and inits the callbacks */
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");
1737 Index: src/mod_proxy.c
1738 ===================================================================
1739 --- src/mod_proxy.c (.../tags/lighttpd-1.4.22) (revision 2504)
1740 +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2504)
1742 return HANDLER_GO_ON;
1745 -void proxy_connection_close(server *srv, handler_ctx *hctx) {
1746 +static void proxy_connection_close(server *srv, handler_ctx *hctx) {
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;
1759 plugin_data *p = hctx->plugin_data;
1760 data_proxy *host= hctx->host;
1761 int proxy_fd = hctx->fd;
1763 - memset(&proxy_addr, 0, sizeof(proxy_addr));
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;
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;
1788 - proxy_addr = (struct sockaddr *) &proxy_addr_in;
1790 if (-1 == connect(proxy_fd, proxy_addr, servlen)) {
1791 if (errno == EINPROGRESS || errno == EALREADY) {
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;
1800 if (NULL == (ds_dst = (data_string *)array_get_unused_element(con->request.headers, TYPE_STRING))) {
1802 array_insert_unique(con->request.headers, (data_unset *)ds_dst);
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;
1809 if (NULL == (ds_dst = (data_string *)array_get_unused_element(con->request.headers, TYPE_STRING))) {
1810 @@ -741,9 +756,16 @@
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;
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;
1828 @@ -1209,7 +1231,7 @@
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;
1837 @@ -1321,6 +1343,7 @@
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");
1845 Index: src/mod_extforward.c
1846 ===================================================================
1847 --- src/mod_extforward.c (.../tags/lighttpd-1.4.22) (revision 2504)
1848 +++ src/mod_extforward.c (.../branches/lighttpd-1.4.x) (revision 2504)
1860 array_free(s->forwarder);
1861 + array_free(s->headers);
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 }
1875 @@ -167,8 +170,10 @@
1877 s = calloc(1, sizeof(plugin_config));
1878 s->forwarder = array_init();
1879 + s->headers = array_init();
1881 cv[0].destination = s->forwarder;
1882 + cv[1].destination = s->headers;
1884 p->config_storage[i] = s;
1887 plugin_config *s = p->config_storage[0];
1892 /* skip the first, the global context */
1893 for (i = 1; i < srv->config_context->used; i++) {
1896 if (buffer_is_equal_string(du->key, CONST_STR_LEN("extforward.forwarder"))) {
1898 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("extforward.headers"))) {
1903 @@ -294,37 +302,37 @@
1907 -struct addrinfo *ipstr_to_sockaddr(const char *host)
1909 - struct addrinfo hints, *res0;
1911 +static struct addrinfo *ipstr_to_sockaddr(const char *host) {
1912 + struct addrinfo hints, *res0;
1915 - memset(&hints, 0, sizeof(hints));
1916 + memset(&hints, 0, sizeof(hints));
1917 #ifndef AI_NUMERICSERV
1919 - * quoting $ man getaddrinfo
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.
1926 + * quoting $ man getaddrinfo
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.
1932 #define AI_NUMERICSERV 0
1934 - hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
1935 + hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
1937 - result = getaddrinfo(host, NULL, &hints, &res0);
1938 - if ( result != 0 )
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 ");
1947 - fprintf(stderr, "Problem in resolving hostname %s: succeeded, but no information returned\n", host);
1948 + result = getaddrinfo(host, NULL, &hints, &res0);
1951 + if (result != 0) {
1952 + fprintf(stderr, "could not resolve hostname %s because %s\n", host, gai_strerror(result));
1954 + if (result == EAI_SYSTEM)
1955 + perror("The system error is ");
1958 + } else if (res0 == 0) {
1959 + fprintf(stderr, "Problem in resolving hostname %s: succeeded, but no information returned\n", host);
1966 @@ -351,16 +359,26 @@
1967 mod_extforward_patch_connection(srv, con, p);
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");
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) {
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;
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");
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");
1998 return HANDLER_GO_ON;
1999 @@ -368,11 +386,10 @@
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),
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);
2013 dst_addr_str = inet_ntoa(con->dst_addr.ipv4.sin_addr);
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;
2024 buffer_copy_string(con->dst_addr_buf, real_remote_addr);
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);
2031 /* Now, clean the conf_cond cache, because we may have changed the results of tests */
2034 /* this function is called at dlopen() time and inits the callbacks */
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");
2040 Index: src/Makefile.am
2041 ===================================================================
2042 --- src/Makefile.am (.../tags/lighttpd-1.4.22) (revision 2504)
2043 +++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2504)
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)
2051 lemon_SOURCES=lemon.c
2053 lighttpd_angel_SOURCES=lighttpd-angel.c
2055 -#simple_fcgi_SOURCES=simple-fcgi.c
2056 -#simple_fcgi_LDADD=-lfcgi
2057 +.PHONY: versionstamp parsers
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)"; \
2067 + if test -n "$$REVISION"; then \
2068 + echo "#define REPO_VERSION \"-devel-$$REVISION\"" > versionstamp.h.tmp; \
2070 + echo "#define REPO_VERSION \"\"" > versionstamp.h.tmp; \
2072 + if ! diff versionstamp.h.tmp versionstamp.h >/dev/null 2>/dev/null; then \
2073 + mv versionstamp.h.tmp versionstamp.h; \
2075 + rm versionstamp.h.tmp; \
2079 configparser.c configparser.h:
2080 mod_ssi_exprparser.c mod_ssi_exprparser.h:
2085 configparser.h: configparser.c
2087 rm -f mod_ssi_exprparser.h
2088 $(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
2091 parsers: configparser.c mod_ssi_exprparser.c
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
2098 common_src=buffer.c log.c \
2099 keyvalue.c chunk.c \
2101 src = server.c response.c connections.c network.c \
2102 configfile.c configparser.c request.c proc_open.c
2104 -spawn_fcgi_SOURCES=spawn-fcgi.c
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 \
2117 -DEFS= @DEFS@ -DLIBRARY_DIR="\"$(libdir)\"" -DSBIN_DIR="\"$(sbindir)\""
2118 +DEFS= @DEFS@ -DHAVE_VERSION_H -DLIBRARY_DIR="\"$(libdir)\"" -DSBIN_DIR="\"$(sbindir)\""
2120 lighttpd_SOURCES = $(src)
2121 lighttpd_LDADD = $(PCRE_LIB) $(DL_LIB) $(SENDFILE_LIB) $(ATTR_LIB) $(common_libadd) $(SSL_LIB) $(FAM_LIBS)
2124 noinst_HEADERS = $(hdr)
2125 EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c SConscript
2127 Index: src/config.h.cmake
2128 ===================================================================
2129 Index: src/mod_expire.c
2130 ===================================================================
2131 --- src/mod_expire.c (.../tags/lighttpd-1.4.22) (revision 2504)
2132 +++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 2504)
2134 return HANDLER_GO_ON;
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) {
2147 if (ds->key->used == 0) continue;
2149 if (0 == strncmp(con->uri.path->ptr, ds->key->ptr, ct_len)) {
2152 + time_t ts, expires;
2154 stat_cache_entry *sce = NULL;
2156 @@ -312,25 +311,26 @@
2157 switch(mod_expire_get_offset(srv, p, ds->value, &ts)) {
2160 - t = (ts + srv->cur_ts);
2161 + expires = (ts + srv->cur_ts);
2166 - t = (ts + sce->st.st_mtime);
2167 + expires = (ts + sce->st.st_mtime);
2170 /* -1 is handled at parse-time */
2174 + /* expires should be at least srv->cur_ts */
2175 + if (expires < srv->cur_ts) expires = srv->cur_ts;
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 */
2182 return HANDLER_GO_ON;
2186 p->expire_tstmp->used = len + 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 */
2194 response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
2198 /* this function is called at dlopen() time and inits the callbacks */
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");
2204 Index: 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);
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");
2216 + log_error_write(srv, __FILE__, __LINE__, "s", "get_password failed");
2221 Index: src/mod_redirect.c
2222 ===================================================================
2223 --- src/mod_redirect.c (.../tags/lighttpd-1.4.22) (revision 2504)
2224 +++ src/mod_redirect.c (.../branches/lighttpd-1.4.x) (revision 2504)
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");
2233 Index: src/mod_usertrack.c
2234 ===================================================================
2235 --- src/mod_usertrack.c (.../tags/lighttpd-1.4.22) (revision 2504)
2236 +++ src/mod_usertrack.c (.../branches/lighttpd-1.4.x) (revision 2504)
2239 /* this function is called at dlopen() time and inits the callbacks */
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");
2245 Index: src/mod_webdav.c
2246 ===================================================================
2247 --- src/mod_webdav.c (.../tags/lighttpd-1.4.22) (revision 2504)
2248 +++ src/mod_webdav.c (.../branches/lighttpd-1.4.x) (revision 2504)
2249 @@ -1096,7 +1096,7 @@
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) {
2258 @@ -1156,7 +1156,7 @@
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) {
2267 @@ -2474,6 +2474,7 @@
2269 /* this function is called at dlopen() time and inits the callbacks */
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");
2275 Index: src/mod_status.c
2276 ===================================================================
2277 --- src/mod_status.c (.../tags/lighttpd-1.4.22) (revision 2504)
2278 +++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2504)
2282 #include "inet_ntop_cache.h"
2283 +#include "version.h"
2288 " <title>Status</title>\n"
2291 - " <h1>" PACKAGE_NAME " " PACKAGE_VERSION "</h1>\n"
2292 + " <h1>" PACKAGE_DESC "</h1>\n"
2293 " <table summary=\"status\" border=\"1\">\n"));
2295 mod_status_header_append(b, "Server-Features");
2297 return HANDLER_GO_ON;
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");
2304 Index: src/mod_compress.c
2305 ===================================================================
2306 --- src/mod_compress.c (.../tags/lighttpd-1.4.22) (revision 2504)
2307 +++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 2504)
2311 /* 0 on success, -1 for error */
2312 -int mkdir_recursive(char *dir) {
2313 +static int mkdir_recursive(char *dir) {
2316 if (!dir || !dir[0])
2320 /* 0 on success, -1 for error */
2321 -int mkdir_for_file(char *filename) {
2322 +static int mkdir_for_file(char *filename) {
2325 if (!filename || !filename[0])
2327 return HANDLER_GO_ON;
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");
2334 Index: src/mod_ssi.c
2335 ===================================================================
2336 --- src/mod_ssi.c (.../tags/lighttpd-1.4.22) (revision 2504)
2337 +++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2504)
2342 +#include "version.h"
2344 /* The newest modified time of included files for include statement */
2345 static volatile time_t include_file_last_mtime = 0;
2347 return HANDLER_GO_ON;
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) {
2354 if (NULL == (ds = (data_string *)array_get_unused_element(env, TYPE_STRING))) {
2355 @@ -199,6 +200,34 @@
2359 + for (i = 0; i < con->environment->used; i++) {
2362 + ds = (data_string *)con->environment->data[i];
2364 + if (ds->value->used && ds->key->used) {
2367 + buffer_reset(srv->tmp_buf);
2368 + buffer_prepare_append(srv->tmp_buf, ds->key->used + 2);
2370 + for (j = 0; j < ds->key->used - 1; j++) {
2372 + if (light_isalpha(ds->key->ptr[j])) {
2374 + c = ds->key->ptr[j] & ~32;
2375 + } else if (light_isdigit(ds->key->ptr[j])) {
2377 + c = ds->key->ptr[j];
2379 + srv->tmp_buf->ptr[srv->tmp_buf->used++] = c;
2381 + srv->tmp_buf->ptr[srv->tmp_buf->used] = '\0';
2383 + ssi_env_add(p->ssi_cgi_env, srv->tmp_buf->ptr, ds->value->ptr);
2392 array_reset(p->ssi_cgi_env);
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"),
2398 inet_ntop(srv_sock->addr.plain.sa_family,
2399 @@ -656,17 +685,22 @@
2400 if (p->if_is_false) break;
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]];
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"));
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]];
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"));
2423 - buffer_append_string_len(b, CONST_STR_LEN("</pre>"));
2427 @@ -1125,6 +1159,7 @@
2429 /* this function is called at dlopen() time and inits the callbacks */
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");
2435 Index: src/mod_auth.c
2436 ===================================================================
2437 --- src/mod_auth.c (.../tags/lighttpd-1.4.22) (revision 2504)
2438 +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2504)
2439 @@ -313,20 +313,20 @@
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 }
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");
2481 Index: 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)
2486 * 64kB (no real reason, just a guess)
2488 #define BUFFER_MAX_REUSE_SIZE (4 * 1024)
2489 +#define MAX_READ_LIMIT (4*1024*1024)
2492 * max size of the HTTP request header
2493 Index: src/mod_cml_lua.c
2494 ===================================================================
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)
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) {
2505 char *key = NULL, *val = NULL;
2506 Index: src/version.h
2507 ===================================================================
2508 --- src/version.h (.../tags/lighttpd-1.4.22) (revision 0)
2509 +++ src/version.h (.../branches/lighttpd-1.4.x) (revision 2504)
2511 +#ifndef _VERSION_H_
2512 +#define _VERSION_H_
2514 +#ifdef HAVE_VERSION_H
2515 +#include "versionstamp.h"
2517 +#define REPO_VERSION ""
2520 +#define PACKAGE_DESC PACKAGE_NAME "/" PACKAGE_VERSION REPO_VERSION
2523 Index: src/mod_evasive.c
2524 ===================================================================
2525 --- src/mod_evasive.c (.../tags/lighttpd-1.4.22) (revision 2504)
2526 +++ src/mod_evasive.c (.../branches/lighttpd-1.4.x) (revision 2504)
2530 unsigned short max_conns;
2531 + unsigned short silent;
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 }
2547 s = calloc(1, sizeof(plugin_config));
2551 cv[0].destination = &(s->max_conns);
2554 plugin_config *s = p->config_storage[0];
2559 /* skip the first, the global context */
2560 for (i = 1; i < srv->config_context->used; i++) {
2563 if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.max-conns-per-ip"))) {
2565 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.silent"))) {
2570 @@ -172,9 +178,11 @@
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.");
2583 con->http_status = 403;
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");
2593 Index: src/mod_setenv.c
2594 ===================================================================
2595 --- src/mod_setenv.c (.../tags/lighttpd-1.4.22) (revision 2504)
2596 +++ src/mod_setenv.c (.../branches/lighttpd-1.4.x) (revision 2504)
2599 /* this function is called at dlopen() time and inits the callbacks */
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");
2605 Index: src/mod_indexfile.c
2606 ===================================================================
2607 --- src/mod_indexfile.c (.../tags/lighttpd-1.4.22) (revision 2504)
2608 +++ src/mod_indexfile.c (.../branches/lighttpd-1.4.x) (revision 2504)
2611 /* this function is called at dlopen() time and inits the callbacks */
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");
2617 Index: src/mod_uploadprogress.c
2618 ===================================================================
2619 Index: src/mod_fastcgi.c
2620 ===================================================================
2621 --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.22) (revision 2504)
2622 +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2504)
2624 #include <sys/wait.h>
2627 +#include "version.h"
2629 #define FCGI_ENV_ADD_CHECK(ret, con) \
2631 con->http_status = 400; \
2632 @@ -316,12 +318,6 @@
2646 /* generic plugin data, shared between all connections */
2649 - buffer_uint fcgi_request_id;
2654 /* ok, we need a prototype */
2655 static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents);
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);
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) {
2669 fastcgi_status_copy_procname(b, host, proc); \
2670 buffer_append_string_len(b, CONST_STR_LEN(x)); \
2675 -fcgi_proc *fastcgi_process_init() {
2676 +static fcgi_proc *fastcgi_process_init() {
2679 f = calloc(1, sizeof(*f));
2684 -void fastcgi_process_free(fcgi_proc *f) {
2685 +static void fastcgi_process_free(fcgi_proc *f) {
2688 fastcgi_process_free(f->next);
2693 -fcgi_extension_host *fastcgi_host_init() {
2694 +static fcgi_extension_host *fastcgi_host_init() {
2695 fcgi_extension_host *f;
2697 f = calloc(1, sizeof(*f));
2702 -void fastcgi_host_free(fcgi_extension_host *h) {
2703 +static void fastcgi_host_free(fcgi_extension_host *h) {
2711 -fcgi_exts *fastcgi_extensions_init() {
2712 +static fcgi_exts *fastcgi_extensions_init() {
2715 f = calloc(1, sizeof(*f));
2720 -void fastcgi_extensions_free(fcgi_exts *f) {
2721 +static void fastcgi_extensions_free(fcgi_exts *f) {
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) {
2734 @@ -633,12 +628,9 @@
2736 FREE_FUNC(mod_fastcgi_free) {
2737 plugin_data *p = p_d;
2738 - buffer_uint *r = &(p->fcgi_request_id);
2742 - if (r->ptr) free(r->ptr);
2744 buffer_free(p->fcgi_env);
2745 buffer_free(p->path);
2746 buffer_free(p->parse_response);
2748 dst = malloc(key_len + val_len + 3);
2749 memcpy(dst, key, 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';
2756 for (i = 0; i < env->used; i++) {
2757 if (0 == strncmp(dst, env->ptr[i], key_len + 1)) {
2758 @@ -1056,10 +1048,7 @@
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",
2770 @@ -1434,52 +1423,7 @@
2774 -static size_t fcgi_requestid_new(server *srv, plugin_data *p) {
2777 - buffer_uint *r = &(p->fcgi_request_id);
2781 - for (i = 0; i < r->used; i++) {
2782 - if (r->ptr[i] > m) m = r->ptr[i];
2785 - if (r->size == 0) {
2787 - r->ptr = malloc(sizeof(*r->ptr) * r->size);
2788 - } else if (r->used == r->size) {
2790 - r->ptr = realloc(r->ptr, sizeof(*r->ptr) * r->size);
2793 - r->ptr[r->used++] = ++m;
2798 -static int fcgi_requestid_del(server *srv, plugin_data *p, size_t request_id) {
2800 - buffer_uint *r = &(p->fcgi_request_id);
2804 - for (i = 0; i < r->used; i++) {
2805 - if (r->ptr[i] == request_id) break;
2808 - if (i != r->used) {
2811 - if (i != r->used - 1) {
2812 - r->ptr[i] = r->ptr[r->used - 1];
2819 -void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2820 +static void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2824 @@ -1495,10 +1439,6 @@
2828 - if (hctx->request_id != 0) {
2829 - fcgi_requestid_del(srv, p, hctx->request_id);
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 @@
2839 - fcgi_requestid_del(srv, p, hctx->request_id);
2841 fcgi_set_state(srv, hctx, FCGI_STATE_INIT);
2843 hctx->request_id = 0;
2844 @@ -1885,10 +1823,18 @@
2845 buffer_prepare_copy(p->fcgi_env, 1024);
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)
2852 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag)),con)
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;
2861 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len),con)
2864 s = inet_ntop(srv_sock->addr.plain.sa_family,
2865 @@ -2060,7 +2006,7 @@
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);
2872 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri)),con)
2874 @@ -2577,7 +2523,7 @@
2875 joblist_append(srv, con);
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);
2883 @@ -3011,7 +2957,7 @@
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 */
2890 log_error_write(srv, __FILE__, __LINE__, "sd",
2891 "fcgi-request is already in use:", hctx->request_id);
2892 @@ -3639,7 +3585,11 @@
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 */
2905 @@ -3648,10 +3598,6 @@
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';
2916 @@ -3916,6 +3862,7 @@
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");
2924 Index: src/CMakeLists.txt
2925 ===================================================================
2926 Index: src/mod_access.c
2927 ===================================================================
2928 --- src/mod_access.c (.../tags/lighttpd-1.4.22) (revision 2504)
2929 +++ src/mod_access.c (.../branches/lighttpd-1.4.x) (revision 2504)
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");
2938 Index: src/mod_accesslog.c
2939 ===================================================================
2940 --- src/mod_accesslog.c (.../tags/lighttpd-1.4.22) (revision 2504)
2941 +++ src/mod_accesslog.c (.../branches/lighttpd-1.4.x) (revision 2504)
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;
2950 if (format->used == 0) return -1;
2951 @@ -475,74 +475,9 @@
2953 if (s->access_logfile->used < 2) continue;
2955 - if (s->access_logfile->ptr[0] == '|') {
2957 - /* create write pipe and spawn process */
2959 - int to_log_fds[2];
2962 - if (pipe(to_log_fds)) {
2963 - log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
2964 - return HANDLER_ERROR;
2967 - /* fork, execve */
2968 - switch (pid = fork()) {
2972 - close(STDIN_FILENO);
2973 - dup2(to_log_fds[0], STDIN_FILENO);
2974 - close(to_log_fds[0]);
2976 - close(to_log_fds[1]);
2978 - openDevNull(STDERR_FILENO);
2980 - /* we don't need the client socket */
2981 - for (i = 3; i < 256; i++) {
2985 - /* exec the log-process (skip the | )
2989 - execl("/bin/sh", "sh", "-c", s->access_logfile->ptr + 1, (char *)NULL);
2991 - log_error_write(srv, __FILE__, __LINE__, "sss",
2992 - "spawning log-process failed: ", strerror(errno),
2993 - s->access_logfile->ptr + 1);
2999 - log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3002 - close(to_log_fds[0]);
3004 - s->log_access_fd = to_log_fds[1];
3011 - } else if (-1 == (s->log_access_fd =
3012 - open(s->access_logfile->ptr, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3014 - log_error_write(srv, __FILE__, __LINE__, "ssb",
3015 - "opening access-log failed:",
3016 - strerror(errno), s->access_logfile);
3018 + if (-1 == (s->log_access_fd = open_logfile_or_pipe(srv, s->access_logfile->ptr)))
3019 return HANDLER_ERROR;
3022 - fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
3027 return HANDLER_GO_ON;
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");
3037 ===================================================================
3038 --- src/server.c (.../tags/lighttpd-1.4.22) (revision 2504)
3039 +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2504)
3042 #include "joblist.h"
3043 #include "network_backends.h"
3044 +#include "version.h"
3046 #ifdef HAVE_GETOPT_H
3049 /* #define USE_ALARM */
3053 +# ifndef HAVE_ISSETUGID
3055 +static int l_issetugid() {
3056 + return (geteuid() != getuid() || getegid() != getgid());
3059 +# define issetugid l_issetugid
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;
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";
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" \
3083 " -f <name> filename of the config-file\n" \
3088 - if (!i_am_root && (geteuid() == 0 || getegid() == 0)) {
3089 + if (!i_am_root && issetugid()) {
3090 /* we are setuid-root */
3092 log_error_write(srv, __FILE__, __LINE__, "s",
3093 Index: src/mod_dirlisting.c
3094 ===================================================================
3095 --- src/mod_dirlisting.c (.../tags/lighttpd-1.4.22) (revision 2504)
3096 +++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 2504)
3098 #include <attr/attributes.h>
3101 +#include "version.h"
3103 /* plugin config for all request/connections */
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;
3116 excludes_buffer *excludes;
3122 -excludes_buffer *excludes_buffer_init(void) {
3123 +static excludes_buffer *excludes_buffer_init(void) {
3124 excludes_buffer *exb;
3126 exb = calloc(1, sizeof(*exb));
3131 -int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3132 +static int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3140 -void excludes_buffer_free(excludes_buffer *exb) {
3141 +static void excludes_buffer_free(excludes_buffer *exb) {
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"
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 */
3165 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
3167 @@ -282,6 +293,10 @@
3168 s->hide_readme_file = 0;
3170 s->hide_header_file = 0;
3171 + s->encode_readme = 1;
3172 + s->encode_header = 1;
3173 + s->auto_layout = 1;
3175 s->encoding = buffer_init();
3176 s->set_footer = buffer_init();
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);
3186 p->config_storage[i] = s;
3187 ca = ((data_config *)srv->config_context->data[i])->value;
3189 PATCH(hide_header_file);
3192 + PATCH(encode_readme);
3193 + PATCH(encode_header);
3194 + PATCH(auto_layout);
3196 /* skip the first, the global context */
3197 for (i = 1; i < srv->config_context->used; i++) {
3198 @@ -360,6 +381,12 @@
3200 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
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);
3211 @@ -454,57 +481,59 @@
3212 static void http_list_directory_header(server *srv, connection *con, plugin_data *p, buffer *out) {
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"
3219 - "<title>Index of "
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"));
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"));
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"
3239 - " font: 90% monospace;"
3240 - " text-align: left;"
3243 - " font-weight: bold;"
3244 - " padding-right: 14px;"
3245 - " padding-bottom: 3px;"
3247 - "td {padding-right: 14px;}\n"
3248 - "td.s, th.s {text-align: right;}\n"
3250 - " background-color: white;"
3251 - " border-top: 1px solid #646464;"
3252 - " border-bottom: 1px solid #646464;"
3253 - " padding-top: 10px;"
3254 - " padding-bottom: 14px;"
3257 - " font: 90% monospace;"
3258 - " color: #787878;"
3259 - " padding-top: 4px;"
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"
3265 + "<title>Index of "
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"));
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"));
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"
3284 + " font: 90% monospace;"
3285 + " text-align: left;"
3288 + " font-weight: bold;"
3289 + " padding-right: 14px;"
3290 + " padding-bottom: 3px;"
3292 + "td {padding-right: 14px;}\n"
3293 + "td.s, th.s {text-align: right;}\n"
3295 + " background-color: white;"
3296 + " border-top: 1px solid #646464;"
3297 + " border-bottom: 1px solid #646464;"
3298 + " padding-top: 10px;"
3299 + " padding-bottom: 14px;"
3302 + " font: 90% monospace;"
3303 + " color: #787878;"
3304 + " padding-top: 4px;"
3310 + buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3313 - buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3316 if (p->conf.show_header) {
3318 @@ -515,9 +544,13 @@
3319 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("HEADER.txt"));
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>"));
3330 + buffer_append_string_len(out, s.start, s.size);
3335 @@ -564,30 +597,36 @@
3336 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("README.txt"));
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>"));
3347 + buffer_append_string_len(out, s.start, s.size);
3353 - buffer_append_string_len(out, CONST_STR_LEN(
3354 - "<div class=\"foot\">"
3356 + if(p->conf.auto_layout) {
3357 + buffer_append_string_len(out, CONST_STR_LEN(
3358 + "<div class=\"foot\">"
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)) {
3364 - buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_NAME "/" PACKAGE_VERSION));
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));
3372 + buffer_append_string_buffer(out, con->conf.server_tag);
3375 + buffer_append_string_len(out, CONST_STR_LEN(
3382 - buffer_append_string_len(out, CONST_STR_LEN(
3389 static int http_list_directory(server *srv, connection *con, plugin_data *p, buffer *dir) {
3392 /* this function is called at dlopen() time and inits the callbacks */
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");
3398 Index: src/mod_magnet.c
3399 ===================================================================
3400 --- src/mod_magnet.c (.../tags/lighttpd-1.4.22) (revision 2504)
3401 +++ src/mod_magnet.c (.../branches/lighttpd-1.4.x) (revision 2504)
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
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 },
3419 { NULL, MAGNET_ENV_UNSET }
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;
3431 /* this function is called at dlopen() time and inits the callbacks */
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");
3441 +int mod_magnet_plugin_init(plugin *p);
3442 int mod_magnet_plugin_init(plugin *p) {
3446 ===================================================================
3447 --- src/log.c (.../tags/lighttpd-1.4.22) (revision 2504)
3448 +++ src/log.c (.../branches/lighttpd-1.4.x) (revision 2504)
3450 return (tmpfd != -1) ? 0 : -1;
3453 +int open_logfile_or_pipe(server *srv, const char* logfile) {
3456 + if (logfile[0] == '|') {
3458 + /* create write pipe and spawn process */
3460 + int to_log_fds[2];
3464 + if (pipe(to_log_fds)) {
3465 + log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
3469 + /* fork, execve */
3470 + switch (pid = fork()) {
3473 + close(STDIN_FILENO);
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));
3482 + close(to_log_fds[0]);
3484 + close(to_log_fds[1]);
3487 + /* we don't need the client socket */
3488 + for (i = 3; i < 256; i++) {
3493 + /* close old stderr */
3494 + openDevNull(STDERR_FILENO);
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),
3506 + log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3509 + close(to_log_fds[0]);
3510 + fd = to_log_fds[1];
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));
3526 + fcntl(fd, F_SETFD, FD_CLOEXEC);
3536 - * we have 3 possibilities:
3537 + * we have 4 possibilities:
3538 * - stderr (default)
3543 * if the open failed, report to the user and die
3545 @@ -80,18 +161,10 @@
3546 } else if (!buffer_is_empty(srv->srvconf.errorlog_file)) {
3547 const char *logfile = srv->srvconf.errorlog_file->ptr;
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));
3554 + if (-1 == (srv->errorlog_fd = open_logfile_or_pipe(srv, logfile))) {
3558 - /* close fd on exec (cgi) */
3559 - fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
3561 - srv->errorlog_mode = ERRORLOG_FILE;
3562 + srv->errorlog_mode = (logfile[0] == '|') ? ERRORLOG_PIPE : ERRORLOG_FILE;
3565 log_error_write(srv, __FILE__, __LINE__, "s", "server started");
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 */
3573 if (srv->errorlog_mode == ERRORLOG_FILE) {
3574 const char *logfile = srv->srvconf.errorlog_file->ptr;
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,
3586 int log_error_close(server *srv) {
3587 switch(srv->errorlog_mode) {
3588 + case ERRORLOG_PIPE:
3590 close(srv->errorlog_fd);
3595 switch(srv->errorlog_mode) {
3596 + case ERRORLOG_PIPE:
3598 case ERRORLOG_STDERR:
3599 /* cache the generated timestamp */
3603 switch(srv->errorlog_mode) {
3604 + case ERRORLOG_PIPE:
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);
3609 ===================================================================
3610 --- src/log.h (.../tags/lighttpd-1.4.22) (revision 2504)
3611 +++ src/log.h (.../branches/lighttpd-1.4.x) (revision 2504)
3614 #define WP() log_error_write(srv, __FILE__, __LINE__, "");
3616 +int open_logfile_or_pipe(server *srv, const char* logfile);
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, ...);
3621 Index: src/fdevent.c
3622 ===================================================================
3623 --- src/fdevent.c (.../tags/lighttpd-1.4.22) (revision 2504)
3624 +++ src/fdevent.c (.../branches/lighttpd-1.4.x) (revision 2504)
3629 -fdnode *fdnode_init() {
3630 +static fdnode *fdnode_init() {
3633 fdn = calloc(1, sizeof(*fdn));
3638 -void fdnode_free(fdnode *fdn) {
3639 +static void fdnode_free(fdnode *fdn) {
3643 Index: tests/fcgi-responder.c
3644 ===================================================================
3645 --- tests/fcgi-responder.c (.../tags/lighttpd-1.4.22) (revision 2504)
3646 +++ tests/fcgi-responder.c (.../branches/lighttpd-1.4.x) (revision 2504)
3648 printf("Status: 500 Internal Foo\r\n\r\n");
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"));
3657 + printf("test123");
3662 Index: tests/mod-fastcgi.t
3663 ===================================================================
3664 --- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.22) (revision 2504)
3665 +++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2504)
3670 -use Test::More tests => 50;
3671 +use Test::More tests => 52;
3674 my $tf = LightyTest->new();
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');
3681 ok($tf->stop_proc == 0, "Stopping lighttpd");
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";
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');
3696 $t->{REQUEST} = ( <<EOF
3697 +GET /abc/def/ghi?path_info HTTP/1.0
3698 +Host: wsgi.example.org
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)');
3704 + $t->{REQUEST} = ( <<EOF
3705 +GET /abc/def/ghi?script_name HTTP/1.0
3706 +Host: wsgi.example.org
3709 + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
3710 + ok($tf->handle_http($t) == 0, 'SCRIPT_NAME (wsgi)');
3713 + $t->{REQUEST} = ( <<EOF
3714 GET /index.fcgi?die-at-end HTTP/1.0
3715 Host: www.example.org
3717 Index: tests/fastcgi-responder.conf
3718 ===================================================================
3719 --- tests/fastcgi-responder.conf (.../tags/lighttpd-1.4.22) (revision 2504)
3720 +++ tests/fastcgi-responder.conf (.../branches/lighttpd-1.4.x) (revision 2504)
3721 @@ -159,3 +159,15 @@
3722 server.name = "zzz.example.org"
3725 +$HTTP["host"] == "wsgi.example.org" {
3726 + fastcgi.server = (
3729 + "host" => "127.0.0.1", "port" => 10000,
3730 + "fix-root-scriptname" => "enable",
3731 + "check-local" => "disable",
3732 + "bin-path" => env.SRCDIR + "/fcgi-responder",
3737 Index: tests/LightyTest.pm
3738 ===================================================================
3739 --- tests/LightyTest.pm (.../tags/lighttpd-1.4.22) (revision 2504)
3740 +++ tests/LightyTest.pm (.../branches/lighttpd-1.4.x) (revision 2504)
3745 -use POSIX ":sys_wait_h";
3746 +use POSIX qw(:sys_wait_h dup2);
3747 +use Errno qw(EADDRINUSE);
3751 @@ -344,8 +345,14 @@
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($?);
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));
3769 ===================================================================
3770 --- configure.ac (.../tags/lighttpd-1.4.22) (revision 0)
3771 +++ configure.ac (.../branches/lighttpd-1.4.x) (revision 2504)
3774 +# Process this file with autoconf to produce a configure script.
3776 +AC_INIT([lighttpd], [1.4.23], [contact@lighttpd.net])
3777 +AC_CONFIG_SRCDIR([src/server.c])
3778 +AC_CONFIG_HEADER([config.h])
3780 +AC_CANONICAL_TARGET
3784 +# Checks for programs.
3795 +dnl check environment
3800 +dnl AC_CANONICAL_HOST
3802 + *darwin*|*cygwin*|*aix*|*mingw* ) NO_RDYNAMIC=yes;;
3803 + * ) NO_RDYNAMIC=no;;
3805 +AM_CONDITIONAL(NO_RDYNAMIC, test x$NO_RDYNAMIC = xyes)
3809 +dnl more automake stuff
3820 +CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__"
3822 +# Checks for header files.
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])
3831 +# Checks for typedefs, structures, and compiler characteristics.
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>])
3844 +# Checks for library functions.
3848 +dnl AC_FUNC_REALLOC
3852 +AC_CHECK_FUNCS([issetugid inet_pton])
3854 +dnl Checks for database.
3858 +AC_MSG_CHECKING(for MySQL support)
3860 + AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']),
3861 + [WITH_MYSQL=$withval],[WITH_MYSQL=no])
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)
3868 + MYSQL_CONFIG=$WITH_MYSQL
3871 + if test "$MYSQL_CONFIG" = ""; then
3872 + AC_MSG_ERROR(mysql_config is not found)
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)
3878 + if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then
3879 + MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`"
3881 + MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`"
3883 + MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`"
3885 + AC_MSG_CHECKING(for MySQL includes at)
3886 + AC_MSG_RESULT($MYSQL_INCLUDE)
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"
3896 + AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
3901 +AC_SUBST(MYSQL_LIBS)
3902 +AC_SUBST(MYSQL_INCLUDE)
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],[
3913 + AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
3914 + AC_DEFINE([HAVE_LDAP_H], [1])
3915 + AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
3918 + AC_SUBST(LDAP_LIB)
3919 + AC_CHECK_LIB(lber, ber_printf, [
3920 + AC_CHECK_HEADERS([lber.h],[
3922 + AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
3923 + AC_DEFINE([HAVE_LBER_H], [1])
3926 + AC_SUBST(LBER_LIB)
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],[
3938 + AC_DEFINE([HAVE_XATTR], [1], [libattr])
3939 + AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
3942 + AC_SUBST(ATTR_LIB)
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)
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"
3957 + AC_DEFINE([HAVE_LIBDL], [1], [libdl])
3958 + AC_DEFINE([HAVE_DLFCN_H], [1])
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])
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])
3979 +if test "$WITH_OPENSSL" != "no"; then
3981 + if test "$WITH_OPENSSL" != "yes"; then
3982 + CPPFLAGS="$CPPFLAGS -I$WITH_OPENSSL/include"
3983 + LDFLAGS="$LDFLAGS -L$WITH_OPENSSL/lib"
3988 +AC_MSG_RESULT([$use_openssl])
3990 +AC_ARG_WITH(openssl-includes,
3991 + AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
3992 + [ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
3995 +AC_ARG_WITH(openssl-libs,
3996 + AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
3997 + [ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
4000 +AC_ARG_WITH(kerberos5,
4001 + AC_HELP_STRING([--with-kerberos5],[use Kerberos5 support with OpenSSL]),
4002 + [ use_kerberos=yes ], [use_kerberos=no]
4005 +if test "x$use_openssl" = "xyes"; then
4006 + if test "x$use_kerberos" != "xyes"; then
4007 + CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
4010 + AC_CHECK_HEADERS([openssl/ssl.h])
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" ])
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])
4025 +if test "x$cross_compiling" = xno -a "$WITH_PCRE" != "no"; then
4026 + AC_PATH_PROG(PCRECONFIG, pcre-config)
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])
4034 + AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
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])
4045 +if test "$WITH_ZLIB" != "no"; then
4046 + AC_CHECK_LIB(z, deflate, [
4047 + AC_CHECK_HEADERS([zlib.h],[
4049 + AC_DEFINE([HAVE_LIBZ], [1], [libz])
4050 + AC_DEFINE([HAVE_ZLIB_H], [1])
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])
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])
4064 +if test "$WITH_BZIP2" != "no"; then
4065 + AC_CHECK_LIB(bz2, BZ2_bzCompress, [
4066 + AC_CHECK_HEADERS([bzlib.h],[
4068 + AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
4069 + AC_DEFINE([HAVE_BZLIB_H], [1])
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])
4078 +if test -z "$PKG_CONFIG"; then
4079 + AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
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])
4088 +if test "$WITH_FAM" != "no"; then
4089 + AC_CHECK_LIB(fam, FAMOpen2, [
4090 + AC_CHECK_HEADERS([fam.h],[
4092 + AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
4093 + AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
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])
4104 + AC_CHECK_FUNCS([FAMNoExists])
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])
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])
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])
4122 + PKG_CHECK_MODULES(SQLITE, sqlite3, [
4123 + AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
4124 + AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
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])
4132 + if test "$WITH_WEBDAV_LOCKS" != "no"; then
4133 + AC_CHECK_LIB(uuid, uuid_unparse, [
4134 + AC_CHECK_HEADERS([uuid/uuid.h],[
4136 + AC_DEFINE([HAVE_UUID], [1], [libuuid])
4137 + AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
4143 +AC_SUBST(UUID_LIBS)
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])
4151 +if test "$WITH_GDBM" != "no"; then
4152 + AC_CHECK_LIB(gdbm, gdbm_open, [
4153 + AC_CHECK_HEADERS([gdbm.h],[
4155 + AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
4156 + AC_DEFINE([HAVE_GDBM_H], [1])
4159 + AC_SUBST(GDBM_LIB)
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])
4175 + AC_SUBST(MEMCACHE_LIB)
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])
4183 +AC_MSG_RESULT($WITH_LUA)
4184 +if test "$WITH_LUA" != "no"; then
4185 + if test "$WITH_LUA" = "yes"; then
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])
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])
4199 + AC_SUBST(LUA_CFLAGS)
4200 + AC_SUBST(LUA_LIBS)
4204 +AC_SEARCH_LIBS(crypt,crypt,[
4205 + AC_CHECK_HEADERS([crypt.h],[
4206 + AC_DEFINE([HAVE_CRYPT_H], [1])
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"
4215 +AC_SUBST(CRYPT_LIB)
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])
4225 +AC_SUBST(SENDFILE_LIB)
4228 + *mingw* ) LIBS="$LIBS -lwsock32";;
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])
4238 +AC_MSG_CHECKING(for Large File System support)
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" ;;
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"
4247 +AC_MSG_RESULT($enableval)
4249 +AC_CHECK_SIZEOF(long)
4250 +AC_CHECK_SIZEOF(off_t)
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
4257 + #ifdef HAVE_SYS_SENDFILE_H
4258 + #include <sys/sendfile.h>
4259 + #endif /* HAVE_SYS_SENDFILE_H */
4260 + #include <errno.h>
4263 + if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
4266 + AC_MSG_RESULT(yes),
4267 + [ AC_MSG_RESULT(no)
4268 + AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) ] )
4270 + AC_MSG_RESULT(no, cross-compiling)
4271 + AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
4275 +dnl Check for IPv6 support
4277 +AC_ARG_ENABLE(ipv6,
4278 + AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
4279 + [case "${enableval}" in
4282 + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
4283 + esac],[ipv6=true])
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])])
4292 + if test "$ac_cv_ipv6_support" = yes; then
4293 + AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
4298 +AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
4300 +dnl check for fastcgi lib, for the tests only
4302 +AC_CHECK_LIB(fcgi, FCGI_Accept, [
4303 + AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h],[
4308 +AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_found" = xyes)
4311 +# check for extra compiler options (warning options)
4312 +if test "${GCC}" = "yes"; then
4313 + CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99"
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])
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"
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])
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 \
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"
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"
4352 + no_build="$no_build $plugins"
4353 + disable_feature="$features"
4356 +plugins="mod_mysql_vhost"
4357 +if test ! "x$MYSQL_LIBS" = x; then
4358 + do_build="$do_build $plugins"
4360 + no_build="$no_build $plugins"
4363 +plugins="mod_cml mod_magnet"
4364 +if test ! "x$LUA_LIBS" = x; then
4365 + do_build="$do_build $plugins"
4367 + no_build="$no_build $plugins"
4370 +features="storage-gdbm"
4371 +if test ! "x$GDBM_LIB" = x; then
4372 + enable_feature="$enable_feature $features"
4374 + disable_feature="$disable_feature $features"
4377 +features="storage-memcache"
4378 +if test ! "x$MEMCACHE_LIB" = x; then
4379 + enable_feature="$enable_feature $features"
4381 + disable_feature="$disable_feature $features"
4384 +features="compress-gzip compress-deflate"
4385 +if test ! "x$Z_LIB" = x; then
4386 + enable_feature="$enable_feature $features"
4388 + disable_feature="$disable_feature $features"
4391 +features="compress-bzip2"
4392 +if test ! "x$BZ_LIB" = x; then
4393 + enable_feature="$enable_feature $features"
4395 + disable_feature="$disable_feature $features"
4398 +features="auth-ldap"
4399 +if test ! "x$LDAP_LIB" = x; then
4400 + enable_feature="$enable_feature $features"
4402 + disable_feature="$disable_feature $features"
4405 +features="network-openssl"
4406 +if test ! "x$SSL_LIB" = x; then
4407 + enable_feature="$enable_feature $features"
4409 + disable_feature="$disable_feature $features"
4413 +features="auth-crypt"
4414 +if test "$ac_cv_search_crypt" = no; then
4415 + disable_feature="$disable_feature $features"
4417 + enable_feature="$enable_feature $features"
4420 +features="network-ipv6"
4421 +if test "$ac_cv_ipv6_support" = yes; then
4422 + enable_feature="$enable_feature $features"
4424 + disable_feature="$disable_feature $features"
4427 +features="large-files"
4428 +if test "$enable_lfs" = yes; then
4429 + enable_feature="$enable_feature $features"
4431 + disable_feature="$disable_feature $features"
4434 +features="stat-cache-fam"
4435 +if test ! "x$FAM_LIBS" = x; then
4436 + enable_feature="$enable_feature $features"
4438 + disable_feature="$disable_feature $features"
4441 +features="webdav-properties"
4442 +if test "x$XML_LIBS" \!= x -a "x$SQLITE_LIBS" \!= x; then
4443 + enable_feature="$enable_feature $features"
4445 + disable_feature="$disable_feature $features"
4448 +features="webdav-locks"
4449 +if test "x$UUID_LIBS" \!= x; then
4450 + enable_feature="$enable_feature $features"
4452 + disable_feature="$disable_feature $features"
4463 +for p in $do_build; do
4468 +for p in $no_build; do
4477 +for p in $enable_feature; do
4482 +for p in $disable_feature; do
4487 Index: doc/lighttpd.1
4488 ===================================================================
4489 --- doc/lighttpd.1 (.../tags/lighttpd-1.4.22) (revision 2504)
4490 +++ doc/lighttpd.1 (.../branches/lighttpd-1.4.x) (revision 2504)
4492 -.TH LIGHTTPD 1 2003-12-21
4494 -lighttpd - a fast, secure and flexible webserver
4496 -lighttpd -D -f <configfile>
4499 -/etc/lighttpd/lighttpd.conf
4503 -HTTP-Authentification - Basic, Digest
4510 Index: doc/spawn-fcgi.1
4511 ===================================================================
4512 --- doc/spawn-fcgi.1 (.../tags/lighttpd-1.4.22) (revision 2504)
4513 +++ doc/spawn-fcgi.1 (.../branches/lighttpd-1.4.x) (revision 2504)
4515 -.TH SPAWNFCGI 1 2003-12-21
4517 -spawn-fcgi \- spawning FastCGI processes
4519 -spawn-fcgi -f <fastcgi-binary> [-p <port> | -s <socket>] [-C <num-of-php-procs>] [-c <chroot-dir>] [-u <username>] [-g <groupname>]
4523 -spawn-fcgi is used to spawn remote FastCGI processes.
4528 Index: 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 @@
4534 bind to the IPv6 socket
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+)
4543 set the string returned by the Server: response header
4545 Index: doc/lighttpd.8
4546 ===================================================================
4547 --- doc/lighttpd.8 (.../tags/lighttpd-1.4.22) (revision 0)
4548 +++ doc/lighttpd.8 (.../branches/lighttpd-1.4.x) (revision 2504)
4550 +.TH LIGHTTPD "8" "2009-03-07" "" ""
4553 +lighttpd \- a fast, secure and flexible web server
4556 +\fBlighttpd\fP [\fB\-ptDvVh\fP] \fB\-f\fP \fIconfigfile\fP [\fB\-m\fP \fImoduledir\fP]
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.
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
4569 +The following options are supported:
4571 +\fB\-f\ \fP \fIconfigfile\fP
4572 +Load configuration file \fIconfigfile\fP.
4574 +\fB\-m\ \fP \fImoduledir\fP
4577 +as the directory that contains modules, instead of the default.
4580 +Print the parsed configuration file in its internal form and exit.
4583 +Test the configuration file for syntax errors and exit.
4586 +Do not daemonize (go into background). The default is to daemonize.
4589 +Show version and exit.
4592 +Show compile-time features and exit.
4595 +Show a brief help message and exit.
4599 +/etc/lighttpd/lighttpd.conf
4600 +The standard location for the configuration file.
4602 +/var/run/lighttpd.pid
4603 +The standard location for the PID of the running \fBlighttpd\fP process.
4606 +Online Documentation: http://wiki.lighttpd.net/
4610 +\fIHypertext Transfer Protocol -- HTTP/1.1\fP, RFC 2616.
4612 +\fIHTTP Authentication: Basic and Digest Access Authentication\fP, RFC 2617.
4614 +\fIThe Common Gateway Interface Version 1.1\fP, RFC 3875.
4616 +\fIThe FastCGI specification\fP.
4619 +Jan Kneschke <jan@kneschke.de>
4620 Index: 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)
4625 %2 => domain name without tld
4626 %3 => subdomain 1 name
4627 %4 => subdomain 2 name
4628 + %_ => the complete hostname (without port info)
4630 evhost.path-pattern = "/home/www/servers/%3/pages/"
4632 Index: 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)
4639 dir-listing.encoding = "utf-8"
4641 +dir-listing.show-readme
4642 + shows README.txt after the dirlisting if it exists in the directory
4646 +dir-listing.hide-readme-file
4647 + hides README.txt in the dirlisting
4651 +dir-listing.show-header
4652 + shows HEADER.txt before the dirlisting if it exists in the directory
4656 +dir-listing.hide-header-file
4657 + hides HEADER.txt in the dirlisting
4661 +dir-listing.set-footer
4663 + Default: empty, uses server.tag instead
4665 +dir-listing.encode-readme
4666 + encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
4670 +dir-listing.encode-header
4671 + encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
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
4679 + you have to enable dir-list.show-readme/header for this of course
4681 + .external-css and .set-footer will be ignored if this is disabled
4684 Index: doc/lighttpd.conf
4685 ===================================================================
4686 --- doc/lighttpd.conf (.../tags/lighttpd-1.4.22) (revision 2504)
4687 +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2504)
4693 # "mod_trigger_b4_dl",
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/"
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
4712 -## don't forget to add index.cml to server.indexfiles
4713 -# cml.extension = ".cml"
4714 -# cml.memcache-hosts = ( "127.0.0.1:11211" )
4716 #### variable usage:
4717 ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
4719 Index: 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)
4729 extforward.forwarder = ("10.0.0.232" => "trust")
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.
4735 + Sets headers to search for finding the originl addresses.
4737 + Example (for use with a Zeus ZXTM loadbalancer): ::
4739 + extforward.headers = ("X-Cluster-Client-Ip")
4741 + Default: empty, results in searching for "X-Forwarded-For" and "Forwarded-For"
4746 Index: doc/Makefile.am
4747 ===================================================================
4748 --- doc/Makefile.am (.../tags/lighttpd-1.4.22) (revision 2504)
4749 +++ doc/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2504)
4751 -dist_man1_MANS=lighttpd.1 spawn-fcgi.1
4752 +dist_man8_MANS=lighttpd.8
4755 DOCS=accesslog.txt \
4756 authentication.txt \
4759 ===================================================================
4761 ===================================================================
4762 --- NEWS (.../tags/lighttpd-1.4.22) (revision 2504)
4763 +++ NEWS (.../branches/lighttpd-1.4.x) (revision 2504)
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)
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)
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)
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)
4811 Index: CMakeLists.txt
4812 ===================================================================
4814 Property changes on: .
4815 ___________________________________________________________________
4816 Modified: bzr:revision-info
4817 - timestamp: 2009-03-07 14:58:05.338000059 +0100
4818 committer: Stefan Bühler <stbuehler@web.de>
4820 branch-nick: lighttpd-1.4.x
4822 + timestamp: 2009-03-07 22:04:32.213999987 +0100
4823 committer: Stefan Bühler <stbuehler@web.de>
4825 branch-nick: lighttpd-1.4.x
4827 Modified: bzr:file-ids
4829 + doc/lighttpd.8 lighttpd.8-20090307205615-mc312p5ocjwthwte-1
4831 Modified: bzr:revision-id:v3-trunk0
4832 - 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
4833 1128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
4834 1129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
4835 1130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
4836 1131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
4837 1132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
4838 1133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
4839 1134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
4840 1135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
4841 1136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
4842 1137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
4843 1138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
4844 1139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
4845 1140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
4846 1141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
4847 1142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
4848 1143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
4849 1144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
4850 1145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
4851 1146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
4852 1147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
4853 1148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
4854 1149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
4855 1150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
4856 1151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
4857 1152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
4858 1153 stbuehler@web.de-20080812194728-fupt781o6q058unh
4859 1154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
4860 1155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
4861 1156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
4862 1157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
4863 1158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
4864 1159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
4865 1160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
4866 1161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
4867 1162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
4868 1163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
4869 1164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
4870 1165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
4871 1166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
4872 1167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
4873 1168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
4874 1169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
4875 1170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
4876 1171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
4877 1172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
4878 1173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
4879 1174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
4880 1175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
4881 1176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
4882 1177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
4883 1178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
4884 1179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
4885 1180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
4886 1181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
4887 1182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
4888 1183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
4889 1184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
4890 1185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
4891 1186 stbuehler@web.de-20081001200802-l5og517etnneitk0
4892 1188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
4893 1189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
4894 1191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
4895 1192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
4896 1193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
4897 1195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
4898 1196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
4899 1197 stbuehler@web.de-20081016121114-65quosenmso8frf8
4900 1198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
4901 1199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
4902 1200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
4903 1201 stbuehler@web.de-20081205233903-708beaujtf26gprx
4904 1202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
4905 1203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
4906 1204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
4907 1205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
4908 1206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
4909 1208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
4910 1209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
4911 1210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
4912 1211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
4913 1212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
4914 1213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
4915 1214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
4916 1215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
4917 1216 stbuehler@web.de-20090205105134-6i5key9439wspueq
4918 1217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
4919 1218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
4920 1219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
4921 1220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
4922 1221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
4923 1222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
4924 1223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
4925 1224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
4926 1225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
4927 1226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
4928 1227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
4929 1228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
4930 1229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
4931 1230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
4932 1231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
4933 1232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
4934 1233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
4935 1234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
4936 1235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
4937 1236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
4939 + 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
4940 1128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
4941 1129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
4942 1130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
4943 1131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
4944 1132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
4945 1133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
4946 1134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
4947 1135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
4948 1136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
4949 1137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
4950 1138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
4951 1139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
4952 1140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
4953 1141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
4954 1142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
4955 1143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
4956 1144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
4957 1145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
4958 1146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
4959 1147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
4960 1148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
4961 1149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
4962 1150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
4963 1151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
4964 1152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
4965 1153 stbuehler@web.de-20080812194728-fupt781o6q058unh
4966 1154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
4967 1155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
4968 1156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
4969 1157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
4970 1158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
4971 1159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
4972 1160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
4973 1161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
4974 1162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
4975 1163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
4976 1164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
4977 1165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
4978 1166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
4979 1167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
4980 1168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
4981 1169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
4982 1170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
4983 1171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
4984 1172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
4985 1173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
4986 1174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
4987 1175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
4988 1176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
4989 1177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
4990 1178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
4991 1179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
4992 1180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
4993 1181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
4994 1182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
4995 1183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
4996 1184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
4997 1185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
4998 1186 stbuehler@web.de-20081001200802-l5og517etnneitk0
4999 1188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
5000 1189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
5001 1191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
5002 1192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
5003 1193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
5004 1195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
5005 1196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
5006 1197 stbuehler@web.de-20081016121114-65quosenmso8frf8
5007 1198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
5008 1199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
5009 1200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
5010 1201 stbuehler@web.de-20081205233903-708beaujtf26gprx
5011 1202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
5012 1203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
5013 1204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
5014 1205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
5015 1206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
5016 1208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
5017 1209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
5018 1210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
5019 1211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
5020 1212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
5021 1213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
5022 1214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
5023 1215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
5024 1216 stbuehler@web.de-20090205105134-6i5key9439wspueq
5025 1217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
5026 1218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
5027 1219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
5028 1220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
5029 1221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
5030 1222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
5031 1223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
5032 1224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
5033 1225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
5034 1226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
5035 1227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
5036 1228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
5037 1229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
5038 1230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
5039 1231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
5040 1232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
5041 1233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
5042 1234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
5043 1235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
5044 1236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
5045 1237 stbuehler@web.de-20090307154555-xybvl7sxrha6vhds
5046 1238 stbuehler@web.de-20090307204326-10m0681831yvhi3k
5047 1239 stbuehler@web.de-20090307204846-seq3cmzn6dy9927i
5048 1240 stbuehler@web.de-20090307205519-ha3s58fcum106yl0
5049 1241 stbuehler@web.de-20090307210432-jdlv5pp9m519vyv2