2 ===================================================================
3 Index: src/spawn-fcgi.c
4 ===================================================================
5 --- src/spawn-fcgi.c (.../tags/lighttpd-1.4.22) (revision 2505)
6 +++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
492 +++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
514 +++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
631 +++ src/mod_cml.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
652 +++ src/mod_secure_download.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
673 +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
713 +++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
752 +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
804 +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
816 +++ src/mod_alias.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
828 +++ src/network.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
883 +++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
911 +++ src/mod_trigger_b4_dl.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
923 +++ src/mod_evhost.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
977 +++ src/splaytree.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
998 +++ src/lemon.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1159 +++ src/chunk.h (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1171 +++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1184 +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1346 +++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1366 +++ src/request.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1409 +++ src/mod_magnet_cache.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1431 +++ src/mod_flv_streaming.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1443 +++ src/mod_rrdtool.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1570 +++ src/stat_cache.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1623 +++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1644 +++ src/SConscript (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1676 +++ src/mod_cml_funcs.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1716 +++ src/mod_simple_vhost.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1728 +++ src/mod_userdir.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1740 +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
1848 +++ src/mod_extforward.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2043 +++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2132 +++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2207 +++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2224 +++ src/mod_redirect.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2236 +++ src/mod_usertrack.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2248 +++ src/mod_webdav.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2278 +++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2307 +++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2337 +++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2438 +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2484 +++ src/settings.h (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
2496 +++ src/mod_cml_lua.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 2505)
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 2505)
2526 +++ src/mod_evasive.c (.../branches/lighttpd-1.4.x) (revision 2505)
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 }, /* 0 */
2541 + { "evasive.silent", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
2542 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
2547 s = calloc(1, sizeof(plugin_config));
2551 cv[0].destination = &(s->max_conns);
2552 + cv[1].destination = &(s->silent);
2554 p->config_storage[i] = s;
2557 plugin_config *s = p->config_storage[0];
2562 /* skip the first, the global context */
2563 for (i = 1; i < srv->config_context->used; i++) {
2566 if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.max-conns-per-ip"))) {
2568 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.silent"))) {
2573 @@ -172,9 +179,11 @@
2576 if (conns_by_ip > p->conf.max_conns) {
2577 - log_error_write(srv, __FILE__, __LINE__, "ss",
2578 - inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
2579 - "turned away. Too many connections.");
2580 + if (!p->conf.silent) {
2581 + log_error_write(srv, __FILE__, __LINE__, "ss",
2582 + inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
2583 + "turned away. Too many connections.");
2586 con->http_status = 403;
2592 +int mod_evasive_plugin_init(plugin *p);
2593 int mod_evasive_plugin_init(plugin *p) {
2594 p->version = LIGHTTPD_VERSION_ID;
2595 p->name = buffer_init_string("evasive");
2596 Index: src/mod_setenv.c
2597 ===================================================================
2598 --- src/mod_setenv.c (.../tags/lighttpd-1.4.22) (revision 2505)
2599 +++ src/mod_setenv.c (.../branches/lighttpd-1.4.x) (revision 2505)
2602 /* this function is called at dlopen() time and inits the callbacks */
2604 +int mod_setenv_plugin_init(plugin *p);
2605 int mod_setenv_plugin_init(plugin *p) {
2606 p->version = LIGHTTPD_VERSION_ID;
2607 p->name = buffer_init_string("setenv");
2608 Index: src/mod_indexfile.c
2609 ===================================================================
2610 --- src/mod_indexfile.c (.../tags/lighttpd-1.4.22) (revision 2505)
2611 +++ src/mod_indexfile.c (.../branches/lighttpd-1.4.x) (revision 2505)
2614 /* this function is called at dlopen() time and inits the callbacks */
2616 +int mod_indexfile_plugin_init(plugin *p);
2617 int mod_indexfile_plugin_init(plugin *p) {
2618 p->version = LIGHTTPD_VERSION_ID;
2619 p->name = buffer_init_string("indexfile");
2620 Index: src/mod_uploadprogress.c
2621 ===================================================================
2622 Index: src/mod_fastcgi.c
2623 ===================================================================
2624 --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.22) (revision 2505)
2625 +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2505)
2627 #include <sys/wait.h>
2630 +#include "version.h"
2632 #define FCGI_ENV_ADD_CHECK(ret, con) \
2634 con->http_status = 400; \
2635 @@ -316,12 +318,6 @@
2649 /* generic plugin data, shared between all connections */
2652 - buffer_uint fcgi_request_id;
2657 /* ok, we need a prototype */
2658 static handler_t fcgi_handle_fdevent(void *s, void *ctx, int revents);
2660 -int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2661 +static int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2662 buffer_copy_string_len(b, CONST_STR_LEN("fastcgi.backend."));
2663 buffer_append_string_buffer(b, host->id);
2669 -int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2670 +static int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
2672 fastcgi_status_copy_procname(b, host, proc); \
2673 buffer_append_string_len(b, CONST_STR_LEN(x)); \
2678 -fcgi_proc *fastcgi_process_init() {
2679 +static fcgi_proc *fastcgi_process_init() {
2682 f = calloc(1, sizeof(*f));
2687 -void fastcgi_process_free(fcgi_proc *f) {
2688 +static void fastcgi_process_free(fcgi_proc *f) {
2691 fastcgi_process_free(f->next);
2696 -fcgi_extension_host *fastcgi_host_init() {
2697 +static fcgi_extension_host *fastcgi_host_init() {
2698 fcgi_extension_host *f;
2700 f = calloc(1, sizeof(*f));
2705 -void fastcgi_host_free(fcgi_extension_host *h) {
2706 +static void fastcgi_host_free(fcgi_extension_host *h) {
2714 -fcgi_exts *fastcgi_extensions_init() {
2715 +static fcgi_exts *fastcgi_extensions_init() {
2718 f = calloc(1, sizeof(*f));
2723 -void fastcgi_extensions_free(fcgi_exts *f) {
2724 +static void fastcgi_extensions_free(fcgi_exts *f) {
2732 -int fastcgi_extension_insert(fcgi_exts *ext, buffer *key, fcgi_extension_host *fh) {
2733 +static int fastcgi_extension_insert(fcgi_exts *ext, buffer *key, fcgi_extension_host *fh) {
2737 @@ -633,12 +628,9 @@
2739 FREE_FUNC(mod_fastcgi_free) {
2740 plugin_data *p = p_d;
2741 - buffer_uint *r = &(p->fcgi_request_id);
2745 - if (r->ptr) free(r->ptr);
2747 buffer_free(p->fcgi_env);
2748 buffer_free(p->path);
2749 buffer_free(p->parse_response);
2751 dst = malloc(key_len + val_len + 3);
2752 memcpy(dst, key, key_len);
2754 - /* add the \0 from the value */
2755 - memcpy(dst + key_len + 1, val, val_len + 1);
2756 + memcpy(dst + key_len + 1, val, val_len);
2757 + dst[key_len + 1 + val_len] = '\0';
2759 for (i = 0; i < env->used; i++) {
2760 if (0 == strncmp(dst, env->ptr[i], key_len + 1)) {
2761 @@ -1056,10 +1048,7 @@
2762 "child exited with status",
2763 WEXITSTATUS(status), host->bin_path);
2764 log_error_write(srv, __FILE__, __LINE__, "s",
2765 - "If you're trying to run PHP as a FastCGI backend, make sure you're using the FastCGI-enabled version.\n"
2766 - "You can find out if it is the right one by executing 'php -v' and it should display '(cgi-fcgi)' "
2767 - "in the output, NOT '(cgi)' NOR '(cli)'.\n"
2768 - "For more information, check http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-program"
2769 + "If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.\n"
2770 "If this is PHP on Gentoo, add 'fastcgi' to the USE flags.");
2771 } else if (WIFSIGNALED(status)) {
2772 log_error_write(srv, __FILE__, __LINE__, "sd",
2773 @@ -1434,52 +1423,7 @@
2777 -static size_t fcgi_requestid_new(server *srv, plugin_data *p) {
2780 - buffer_uint *r = &(p->fcgi_request_id);
2784 - for (i = 0; i < r->used; i++) {
2785 - if (r->ptr[i] > m) m = r->ptr[i];
2788 - if (r->size == 0) {
2790 - r->ptr = malloc(sizeof(*r->ptr) * r->size);
2791 - } else if (r->used == r->size) {
2793 - r->ptr = realloc(r->ptr, sizeof(*r->ptr) * r->size);
2796 - r->ptr[r->used++] = ++m;
2801 -static int fcgi_requestid_del(server *srv, plugin_data *p, size_t request_id) {
2803 - buffer_uint *r = &(p->fcgi_request_id);
2807 - for (i = 0; i < r->used; i++) {
2808 - if (r->ptr[i] == request_id) break;
2811 - if (i != r->used) {
2814 - if (i != r->used - 1) {
2815 - r->ptr[i] = r->ptr[r->used - 1];
2822 -void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2823 +static void fcgi_connection_close(server *srv, handler_ctx *hctx) {
2827 @@ -1495,10 +1439,6 @@
2831 - if (hctx->request_id != 0) {
2832 - fcgi_requestid_del(srv, p, hctx->request_id);
2835 if (hctx->host && hctx->proc) {
2836 if (hctx->got_proc) {
2837 /* after the connect the process gets a load */
2838 @@ -1556,8 +1496,6 @@
2842 - fcgi_requestid_del(srv, p, hctx->request_id);
2844 fcgi_set_state(srv, hctx, FCGI_STATE_INIT);
2846 hctx->request_id = 0;
2847 @@ -1885,10 +1823,18 @@
2848 buffer_prepare_copy(p->fcgi_env, 1024);
2851 - FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION)),con)
2852 + if (buffer_is_empty(con->conf.server_tag)) {
2853 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_DESC)),con)
2855 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_BUF_LEN(con->conf.server_tag)),con)
2858 if (con->server_name->used) {
2859 - FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name)),con)
2860 + size_t len = con->server_name->used - 1;
2861 + char *colon = strchr(con->server_name->ptr, ':');
2862 + if (colon) len = colon - con->server_name->ptr;
2864 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len),con)
2867 s = inet_ntop(srv_sock->addr.plain.sa_family,
2868 @@ -2060,7 +2006,7 @@
2870 fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REQUEST_URI"),
2871 con->request.orig_uri->ptr + (host->strip_request_uri->used - 2),
2872 - con->request.orig_uri->used - (host->strip_request_uri->used - 2));
2873 + con->request.orig_uri->used - (host->strip_request_uri->used - 2) - 1);
2875 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri)),con)
2877 @@ -2577,7 +2523,7 @@
2878 joblist_append(srv, con);
2880 buffer_copy_string_len(dcls->key, "Content-Length", sizeof("Content-Length")-1);
2881 - buffer_copy_long(dcls->value, sce->st.st_size);
2882 + buffer_copy_off_t(dcls->value, sce->st.st_size);
2883 dcls = (data_string*) array_replace(con->response.headers, (data_unset *)dcls);
2884 if (dcls) dcls->free((data_unset*)dcls);
2886 @@ -3011,7 +2957,7 @@
2888 /* move the proc-list entry down the list */
2889 if (hctx->request_id == 0) {
2890 - hctx->request_id = fcgi_requestid_new(srv, p);
2891 + hctx->request_id = 1; /* always use id 1 as we don't use multiplexing */
2893 log_error_write(srv, __FILE__, __LINE__, "sd",
2894 "fcgi-request is already in use:", hctx->request_id);
2895 @@ -3639,7 +3585,11 @@
2898 /* the rewrite is only done for /prefix/? matches */
2899 - if (extension->key->ptr[0] == '/' &&
2900 + if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
2901 + buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
2902 + con->uri.path->used = 1;
2903 + con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2904 + } else if (extension->key->ptr[0] == '/' &&
2905 con->uri.path->used > extension->key->used &&
2906 NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
2907 /* rewrite uri.path and pathinfo */
2908 @@ -3648,10 +3598,6 @@
2910 con->uri.path->used -= con->request.pathinfo->used - 1;
2911 con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2912 - } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
2913 - buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
2914 - con->uri.path->used = 1;
2915 - con->uri.path->ptr[con->uri.path->used - 1] = '\0';
2919 @@ -3916,6 +3862,7 @@
2923 +int mod_fastcgi_plugin_init(plugin *p);
2924 int mod_fastcgi_plugin_init(plugin *p) {
2925 p->version = LIGHTTPD_VERSION_ID;
2926 p->name = buffer_init_string("fastcgi");
2927 Index: src/CMakeLists.txt
2928 ===================================================================
2929 Index: src/mod_access.c
2930 ===================================================================
2931 --- src/mod_access.c (.../tags/lighttpd-1.4.22) (revision 2505)
2932 +++ src/mod_access.c (.../branches/lighttpd-1.4.x) (revision 2505)
2937 +int mod_access_plugin_init(plugin *p);
2938 int mod_access_plugin_init(plugin *p) {
2939 p->version = LIGHTTPD_VERSION_ID;
2940 p->name = buffer_init_string("access");
2941 Index: src/mod_accesslog.c
2942 ===================================================================
2943 --- src/mod_accesslog.c (.../tags/lighttpd-1.4.22) (revision 2505)
2944 +++ src/mod_accesslog.c (.../branches/lighttpd-1.4.x) (revision 2505)
2949 -int accesslog_parse_format(server *srv, format_fields *fields, buffer *format) {
2950 +static int accesslog_parse_format(server *srv, format_fields *fields, buffer *format) {
2951 size_t i, j, k = 0, start = 0;
2953 if (format->used == 0) return -1;
2954 @@ -475,74 +475,9 @@
2956 if (s->access_logfile->used < 2) continue;
2958 - if (s->access_logfile->ptr[0] == '|') {
2960 - /* create write pipe and spawn process */
2962 - int to_log_fds[2];
2965 - if (pipe(to_log_fds)) {
2966 - log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
2967 - return HANDLER_ERROR;
2970 - /* fork, execve */
2971 - switch (pid = fork()) {
2975 - close(STDIN_FILENO);
2976 - dup2(to_log_fds[0], STDIN_FILENO);
2977 - close(to_log_fds[0]);
2979 - close(to_log_fds[1]);
2981 - openDevNull(STDERR_FILENO);
2983 - /* we don't need the client socket */
2984 - for (i = 3; i < 256; i++) {
2988 - /* exec the log-process (skip the | )
2992 - execl("/bin/sh", "sh", "-c", s->access_logfile->ptr + 1, (char *)NULL);
2994 - log_error_write(srv, __FILE__, __LINE__, "sss",
2995 - "spawning log-process failed: ", strerror(errno),
2996 - s->access_logfile->ptr + 1);
3002 - log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3005 - close(to_log_fds[0]);
3007 - s->log_access_fd = to_log_fds[1];
3014 - } else if (-1 == (s->log_access_fd =
3015 - open(s->access_logfile->ptr, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3017 - log_error_write(srv, __FILE__, __LINE__, "ssb",
3018 - "opening access-log failed:",
3019 - strerror(errno), s->access_logfile);
3021 + if (-1 == (s->log_access_fd = open_logfile_or_pipe(srv, s->access_logfile->ptr)))
3022 return HANDLER_ERROR;
3025 - fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
3030 return HANDLER_GO_ON;
3035 +int mod_accesslog_plugin_init(plugin *p);
3036 int mod_accesslog_plugin_init(plugin *p) {
3037 p->version = LIGHTTPD_VERSION_ID;
3038 p->name = buffer_init_string("accesslog");
3040 ===================================================================
3041 --- src/server.c (.../tags/lighttpd-1.4.22) (revision 2505)
3042 +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2505)
3045 #include "joblist.h"
3046 #include "network_backends.h"
3047 +#include "version.h"
3049 #ifdef HAVE_GETOPT_H
3052 /* #define USE_ALARM */
3056 +# ifndef HAVE_ISSETUGID
3058 +static int l_issetugid() {
3059 + return (geteuid() != getuid() || getegid() != getgid());
3062 +# define issetugid l_issetugid
3066 static volatile sig_atomic_t srv_shutdown = 0;
3067 static volatile sig_atomic_t graceful_shutdown = 0;
3068 static volatile sig_atomic_t handle_sig_alarm = 1;
3073 - char *b = PACKAGE_NAME "-" PACKAGE_VERSION TEXT_SSL \
3074 + char *b = PACKAGE_DESC TEXT_SSL \
3075 " - a light and fast webserver\n" \
3076 "Build-Date: " __DATE__ " " __TIME__ "\n";
3082 - char *b = PACKAGE_NAME "-" PACKAGE_VERSION TEXT_SSL " ("__DATE__ " " __TIME__ ")" \
3083 + char *b = PACKAGE_DESC TEXT_SSL " ("__DATE__ " " __TIME__ ")" \
3084 " - a light and fast webserver\n" \
3086 " -f <name> filename of the config-file\n" \
3091 - if (!i_am_root && (geteuid() == 0 || getegid() == 0)) {
3092 + if (!i_am_root && issetugid()) {
3093 /* we are setuid-root */
3095 log_error_write(srv, __FILE__, __LINE__, "s",
3096 Index: src/mod_dirlisting.c
3097 ===================================================================
3098 --- src/mod_dirlisting.c (.../tags/lighttpd-1.4.22) (revision 2505)
3099 +++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 2505)
3101 #include <attr/attributes.h>
3104 +#include "version.h"
3106 /* plugin config for all request/connections */
3110 unsigned short hide_dot_files;
3111 unsigned short show_readme;
3112 unsigned short hide_readme_file;
3113 + unsigned short encode_readme;
3114 unsigned short show_header;
3115 unsigned short hide_header_file;
3116 + unsigned short encode_header;
3117 + unsigned short auto_layout;
3119 excludes_buffer *excludes;
3125 -excludes_buffer *excludes_buffer_init(void) {
3126 +static excludes_buffer *excludes_buffer_init(void) {
3127 excludes_buffer *exb;
3129 exb = calloc(1, sizeof(*exb));
3134 -int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3135 +static int excludes_buffer_append(excludes_buffer *exb, buffer *string) {
3143 -void excludes_buffer_free(excludes_buffer *exb) {
3144 +static void excludes_buffer_free(excludes_buffer *exb) {
3149 #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
3150 #define CONFIG_DIR_LISTING "server.dir-listing"
3151 #define CONFIG_SET_FOOTER "dir-listing.set-footer"
3152 +#define CONFIG_ENCODE_README "dir-listing.encode-readme"
3153 +#define CONFIG_ENCODE_HEADER "dir-listing.encode-header"
3154 +#define CONFIG_AUTO_LAYOUT "dir-listing.auto-layout"
3157 SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
3158 @@ -260,7 +268,10 @@
3159 { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
3160 { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
3161 { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
3162 - { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
3163 + { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
3164 + { CONFIG_ENCODE_README, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
3165 + { CONFIG_ENCODE_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
3166 + { CONFIG_AUTO_LAYOUT, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
3168 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
3170 @@ -282,6 +293,10 @@
3171 s->hide_readme_file = 0;
3173 s->hide_header_file = 0;
3174 + s->encode_readme = 1;
3175 + s->encode_header = 1;
3176 + s->auto_layout = 1;
3178 s->encoding = buffer_init();
3179 s->set_footer = buffer_init();
3182 cv[8].destination = &(s->hide_header_file);
3183 cv[9].destination = &(s->dir_listing); /* old name */
3184 cv[10].destination = s->set_footer;
3185 + cv[11].destination = &(s->encode_readme);
3186 + cv[12].destination = &(s->encode_header);
3187 + cv[13].destination = &(s->auto_layout);
3189 p->config_storage[i] = s;
3190 ca = ((data_config *)srv->config_context->data[i])->value;
3192 PATCH(hide_header_file);
3195 + PATCH(encode_readme);
3196 + PATCH(encode_header);
3197 + PATCH(auto_layout);
3199 /* skip the first, the global context */
3200 for (i = 1; i < srv->config_context->used; i++) {
3201 @@ -360,6 +381,12 @@
3203 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
3205 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ENCODE_README))) {
3206 + PATCH(encode_readme);
3207 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ENCODE_HEADER))) {
3208 + PATCH(encode_header);
3209 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_AUTO_LAYOUT))) {
3210 + PATCH(auto_layout);
3214 @@ -454,57 +481,59 @@
3215 static void http_list_directory_header(server *srv, connection *con, plugin_data *p, buffer *out) {
3218 - buffer_append_string_len(out, CONST_STR_LEN(
3219 - "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
3220 - "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"
3222 - "<title>Index of "
3224 - buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
3225 - buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
3227 - if (p->conf.external_css->used > 1) {
3228 - buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
3229 - buffer_append_string_buffer(out, p->conf.external_css);
3230 - buffer_append_string_len(out, CONST_STR_LEN("\" />\n"));
3232 + if (p->conf.auto_layout) {
3233 buffer_append_string_len(out, CONST_STR_LEN(
3234 - "<style type=\"text/css\">\n"
3235 - "a, a:active {text-decoration: none; color: blue;}\n"
3236 - "a:visited {color: #48468F;}\n"
3237 - "a:hover, a:focus {text-decoration: underline; color: red;}\n"
3238 - "body {background-color: #F5F5F5;}\n"
3239 - "h2 {margin-bottom: 12px;}\n"
3240 - "table {margin-left: 12px;}\n"
3242 - " font: 90% monospace;"
3243 - " text-align: left;"
3246 - " font-weight: bold;"
3247 - " padding-right: 14px;"
3248 - " padding-bottom: 3px;"
3250 - "td {padding-right: 14px;}\n"
3251 - "td.s, th.s {text-align: right;}\n"
3253 - " background-color: white;"
3254 - " border-top: 1px solid #646464;"
3255 - " border-bottom: 1px solid #646464;"
3256 - " padding-top: 10px;"
3257 - " padding-bottom: 14px;"
3260 - " font: 90% monospace;"
3261 - " color: #787878;"
3262 - " padding-top: 4px;"
3265 + "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
3266 + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"
3268 + "<title>Index of "
3270 + buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
3271 + buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
3273 + if (p->conf.external_css->used > 1) {
3274 + buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
3275 + buffer_append_string_buffer(out, p->conf.external_css);
3276 + buffer_append_string_len(out, CONST_STR_LEN("\" />\n"));
3278 + buffer_append_string_len(out, CONST_STR_LEN(
3279 + "<style type=\"text/css\">\n"
3280 + "a, a:active {text-decoration: none; color: blue;}\n"
3281 + "a:visited {color: #48468F;}\n"
3282 + "a:hover, a:focus {text-decoration: underline; color: red;}\n"
3283 + "body {background-color: #F5F5F5;}\n"
3284 + "h2 {margin-bottom: 12px;}\n"
3285 + "table {margin-left: 12px;}\n"
3287 + " font: 90% monospace;"
3288 + " text-align: left;"
3291 + " font-weight: bold;"
3292 + " padding-right: 14px;"
3293 + " padding-bottom: 3px;"
3295 + "td {padding-right: 14px;}\n"
3296 + "td.s, th.s {text-align: right;}\n"
3298 + " background-color: white;"
3299 + " border-top: 1px solid #646464;"
3300 + " border-bottom: 1px solid #646464;"
3301 + " padding-top: 10px;"
3302 + " padding-bottom: 14px;"
3305 + " font: 90% monospace;"
3306 + " color: #787878;"
3307 + " padding-top: 4px;"
3313 + buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3316 - buffer_append_string_len(out, CONST_STR_LEN("</head>\n<body>\n"));
3319 if (p->conf.show_header) {
3321 @@ -515,9 +544,13 @@
3322 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("HEADER.txt"));
3324 if (-1 != stream_open(&s, p->tmp_buf)) {
3325 - buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"header\">"));
3326 - buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3327 - buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3328 + if (p->conf.encode_header) {
3329 + buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"header\">"));
3330 + buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3331 + buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3333 + buffer_append_string_len(out, s.start, s.size);
3338 @@ -564,30 +597,36 @@
3339 buffer_append_string_len(p->tmp_buf, CONST_STR_LEN("README.txt"));
3341 if (-1 != stream_open(&s, p->tmp_buf)) {
3342 - buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"readme\">"));
3343 - buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3344 - buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3345 + if (p->conf.encode_readme) {
3346 + buffer_append_string_len(out, CONST_STR_LEN("<pre class=\"readme\">"));
3347 + buffer_append_string_encoded(out, s.start, s.size, ENCODING_MINIMAL_XML);
3348 + buffer_append_string_len(out, CONST_STR_LEN("</pre>"));
3350 + buffer_append_string_len(out, s.start, s.size);
3356 - buffer_append_string_len(out, CONST_STR_LEN(
3357 - "<div class=\"foot\">"
3359 + if(p->conf.auto_layout) {
3360 + buffer_append_string_len(out, CONST_STR_LEN(
3361 + "<div class=\"foot\">"
3364 - if (p->conf.set_footer->used > 1) {
3365 - buffer_append_string_buffer(out, p->conf.set_footer);
3366 - } else if (buffer_is_empty(con->conf.server_tag)) {
3367 - buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_NAME "/" PACKAGE_VERSION));
3369 - buffer_append_string_buffer(out, con->conf.server_tag);
3370 + if (p->conf.set_footer->used > 1) {
3371 + buffer_append_string_buffer(out, p->conf.set_footer);
3372 + } else if (buffer_is_empty(con->conf.server_tag)) {
3373 + buffer_append_string_len(out, CONST_STR_LEN(PACKAGE_DESC));
3375 + buffer_append_string_buffer(out, con->conf.server_tag);
3378 + buffer_append_string_len(out, CONST_STR_LEN(
3385 - buffer_append_string_len(out, CONST_STR_LEN(
3392 static int http_list_directory(server *srv, connection *con, plugin_data *p, buffer *dir) {
3395 /* this function is called at dlopen() time and inits the callbacks */
3397 +int mod_dirlisting_plugin_init(plugin *p);
3398 int mod_dirlisting_plugin_init(plugin *p) {
3399 p->version = LIGHTTPD_VERSION_ID;
3400 p->name = buffer_init_string("dirlisting");
3401 Index: src/mod_magnet.c
3402 ===================================================================
3403 --- src/mod_magnet.c (.../tags/lighttpd-1.4.22) (revision 2505)
3404 +++ src/mod_magnet.c (.../branches/lighttpd-1.4.x) (revision 2505)
3406 MAGNET_ENV_REQUEST_METHOD,
3407 MAGNET_ENV_REQUEST_URI,
3408 MAGNET_ENV_REQUEST_ORIG_URI,
3409 + MAGNET_ENV_REQUEST_PATH_INFO,
3410 + MAGNET_ENV_REQUEST_REMOTE_IP,
3411 MAGNET_ENV_REQUEST_PROTOCOL
3415 { "request.method", MAGNET_ENV_REQUEST_METHOD },
3416 { "request.uri", MAGNET_ENV_REQUEST_URI },
3417 { "request.orig-uri", MAGNET_ENV_REQUEST_ORIG_URI },
3418 + { "request.path-info", MAGNET_ENV_REQUEST_PATH_INFO },
3419 + { "request.remote-ip", MAGNET_ENV_REQUEST_REMOTE_IP },
3420 { "request.protocol", MAGNET_ENV_REQUEST_PROTOCOL },
3422 { NULL, MAGNET_ENV_UNSET }
3425 case MAGNET_ENV_REQUEST_URI: dest = con->request.uri; break;
3426 case MAGNET_ENV_REQUEST_ORIG_URI: dest = con->request.orig_uri; break;
3427 + case MAGNET_ENV_REQUEST_PATH_INFO: dest = con->request.pathinfo; break;
3428 + case MAGNET_ENV_REQUEST_REMOTE_IP: dest = con->dst_addr_buf; break;
3429 case MAGNET_ENV_REQUEST_PROTOCOL:
3430 buffer_copy_string(srv->tmp_buf, get_http_version_name(con->request.http_version));
3431 dest = srv->tmp_buf;
3434 /* this function is called at dlopen() time and inits the callbacks */
3436 +int mod_magnet_plugin_init(plugin *p);
3437 int mod_magnet_plugin_init(plugin *p) {
3438 p->version = LIGHTTPD_VERSION_ID;
3439 p->name = buffer_init_string("magnet");
3444 +int mod_magnet_plugin_init(plugin *p);
3445 int mod_magnet_plugin_init(plugin *p) {
3449 ===================================================================
3450 --- src/log.c (.../tags/lighttpd-1.4.22) (revision 2505)
3451 +++ src/log.c (.../branches/lighttpd-1.4.x) (revision 2505)
3453 return (tmpfd != -1) ? 0 : -1;
3456 +int open_logfile_or_pipe(server *srv, const char* logfile) {
3459 + if (logfile[0] == '|') {
3461 + /* create write pipe and spawn process */
3463 + int to_log_fds[2];
3467 + if (pipe(to_log_fds)) {
3468 + log_error_write(srv, __FILE__, __LINE__, "ss", "pipe failed: ", strerror(errno));
3472 + /* fork, execve */
3473 + switch (pid = fork()) {
3476 + close(STDIN_FILENO);
3478 + /* dup the filehandle to STDIN */
3479 + if (to_log_fds[0] != STDIN_FILENO) {
3480 + if (STDIN_FILENO != dup2(to_log_fds[0], STDIN_FILENO)) {
3481 + log_error_write(srv, __FILE__, __LINE__, "ss",
3482 + "dup2 failed: ", strerror(errno));
3485 + close(to_log_fds[0]);
3487 + close(to_log_fds[1]);
3490 + /* we don't need the client socket */
3491 + for (i = 3; i < 256; i++) {
3496 + /* close old stderr */
3497 + openDevNull(STDERR_FILENO);
3499 + /* exec the log-process (skip the | ) */
3500 + execl("/bin/sh", "sh", "-c", logfile + 1, NULL);
3501 + log_error_write(srv, __FILE__, __LINE__, "sss",
3502 + "spawning log process failed: ", strerror(errno),
3509 + log_error_write(srv, __FILE__, __LINE__, "ss", "fork failed: ", strerror(errno));
3512 + close(to_log_fds[0]);
3513 + fd = to_log_fds[1];
3520 + } else if (-1 == (fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3521 + log_error_write(srv, __FILE__, __LINE__, "SSSS",
3522 + "opening errorlog '", logfile,
3523 + "' failed: ", strerror(errno));
3529 + fcntl(fd, F_SETFD, FD_CLOEXEC);
3539 - * we have 3 possibilities:
3540 + * we have 4 possibilities:
3541 * - stderr (default)
3546 * if the open failed, report to the user and die
3548 @@ -80,18 +161,10 @@
3549 } else if (!buffer_is_empty(srv->srvconf.errorlog_file)) {
3550 const char *logfile = srv->srvconf.errorlog_file->ptr;
3552 - if (-1 == (srv->errorlog_fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3553 - log_error_write(srv, __FILE__, __LINE__, "SSSS",
3554 - "opening errorlog '", logfile,
3555 - "' failed: ", strerror(errno));
3557 + if (-1 == (srv->errorlog_fd = open_logfile_or_pipe(srv, logfile))) {
3561 - /* close fd on exec (cgi) */
3562 - fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
3564 - srv->errorlog_mode = ERRORLOG_FILE;
3565 + srv->errorlog_mode = (logfile[0] == '|') ? ERRORLOG_PIPE : ERRORLOG_FILE;
3568 log_error_write(srv, __FILE__, __LINE__, "s", "server started");
3572 int log_error_cycle(server *srv) {
3573 - /* only cycle if we are not in syslog-mode */
3574 + /* only cycle if the error log is a file */
3576 if (srv->errorlog_mode == ERRORLOG_FILE) {
3577 const char *logfile = srv->srvconf.errorlog_file->ptr;
3582 - if (-1 == (new_fd = open(logfile, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE, 0644))) {
3583 + if (-1 == (new_fd = open_logfile_or_pipe(srv, logfile))) {
3584 /* write to old log */
3585 log_error_write(srv, __FILE__, __LINE__, "SSSSS",
3586 "cycling errorlog '", logfile,
3589 int log_error_close(server *srv) {
3590 switch(srv->errorlog_mode) {
3591 + case ERRORLOG_PIPE:
3593 close(srv->errorlog_fd);
3598 switch(srv->errorlog_mode) {
3599 + case ERRORLOG_PIPE:
3601 case ERRORLOG_STDERR:
3602 /* cache the generated timestamp */
3606 switch(srv->errorlog_mode) {
3607 + case ERRORLOG_PIPE:
3609 buffer_append_string_len(srv->errorlog_buf, CONST_STR_LEN("\n"));
3610 write(srv->errorlog_fd, srv->errorlog_buf->ptr, srv->errorlog_buf->used - 1);
3612 ===================================================================
3613 --- src/log.h (.../tags/lighttpd-1.4.22) (revision 2505)
3614 +++ src/log.h (.../branches/lighttpd-1.4.x) (revision 2505)
3617 #define WP() log_error_write(srv, __FILE__, __LINE__, "");
3619 +int open_logfile_or_pipe(server *srv, const char* logfile);
3621 int log_error_open(server *srv);
3622 int log_error_close(server *srv);
3623 int log_error_write(server *srv, const char *filename, unsigned int line, const char *fmt, ...);
3624 Index: src/fdevent.c
3625 ===================================================================
3626 --- src/fdevent.c (.../tags/lighttpd-1.4.22) (revision 2505)
3627 +++ src/fdevent.c (.../branches/lighttpd-1.4.x) (revision 2505)
3632 -fdnode *fdnode_init() {
3633 +static fdnode *fdnode_init() {
3636 fdn = calloc(1, sizeof(*fdn));
3641 -void fdnode_free(fdnode *fdn) {
3642 +static void fdnode_free(fdnode *fdn) {
3646 Index: tests/fcgi-responder.c
3647 ===================================================================
3648 --- tests/fcgi-responder.c (.../tags/lighttpd-1.4.22) (revision 2505)
3649 +++ tests/fcgi-responder.c (.../branches/lighttpd-1.4.x) (revision 2505)
3651 printf("Status: 500 Internal Foo\r\n\r\n");
3654 - printf("test123");
3655 + if (0 == strcmp(p, "path_info")) {
3656 + printf("%s", getenv("PATH_INFO"));
3657 + } else if (0 == strcmp(p, "script_name")) {
3658 + printf("%s", getenv("SCRIPT_NAME"));
3660 + printf("test123");
3665 Index: tests/mod-fastcgi.t
3666 ===================================================================
3667 --- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.22) (revision 2505)
3668 +++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2505)
3673 -use Test::More tests => 50;
3674 +use Test::More tests => 52;
3677 my $tf = LightyTest->new();
3679 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ];
3680 ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off');
3684 ok($tf->stop_proc == 0, "Stopping lighttpd");
3691 - skip "no fcgi-responder found", 9 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
3692 + skip "no fcgi-responder found", 11 unless -x $tf->{BASEDIR}."/tests/fcgi-responder" || -x $tf->{BASEDIR}."/tests/fcgi-responder.exe";
3694 $tf->{CONFIGFILE} = 'fastcgi-responder.conf';
3695 ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
3696 @@ -319,6 +319,23 @@
3697 ok($tf->handle_http($t) == 0, 'line-ending \r\n + \r\n');
3699 $t->{REQUEST} = ( <<EOF
3700 +GET /abc/def/ghi?path_info HTTP/1.0
3701 +Host: wsgi.example.org
3704 + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/abc/def/ghi' } ];
3705 + ok($tf->handle_http($t) == 0, 'PATH_INFO (wsgi)');
3707 + $t->{REQUEST} = ( <<EOF
3708 +GET /abc/def/ghi?script_name HTTP/1.0
3709 +Host: wsgi.example.org
3712 + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
3713 + ok($tf->handle_http($t) == 0, 'SCRIPT_NAME (wsgi)');
3716 + $t->{REQUEST} = ( <<EOF
3717 GET /index.fcgi?die-at-end HTTP/1.0
3718 Host: www.example.org
3720 Index: tests/fastcgi-responder.conf
3721 ===================================================================
3722 --- tests/fastcgi-responder.conf (.../tags/lighttpd-1.4.22) (revision 2505)
3723 +++ tests/fastcgi-responder.conf (.../branches/lighttpd-1.4.x) (revision 2505)
3724 @@ -159,3 +159,15 @@
3725 server.name = "zzz.example.org"
3728 +$HTTP["host"] == "wsgi.example.org" {
3729 + fastcgi.server = (
3732 + "host" => "127.0.0.1", "port" => 10000,
3733 + "fix-root-scriptname" => "enable",
3734 + "check-local" => "disable",
3735 + "bin-path" => env.SRCDIR + "/fcgi-responder",
3740 Index: tests/LightyTest.pm
3741 ===================================================================
3742 --- tests/LightyTest.pm (.../tags/lighttpd-1.4.22) (revision 2505)
3743 +++ tests/LightyTest.pm (.../branches/lighttpd-1.4.x) (revision 2505)
3748 -use POSIX ":sys_wait_h";
3749 +use POSIX qw(:sys_wait_h dup2);
3750 +use Errno qw(EADDRINUSE);
3754 @@ -344,8 +345,14 @@
3758 - my $cmd = $self->{BINDIR}.'/spawn-fcgi -n -p '.$port.' -f "'.$binary.'"';
3759 - exec $cmd or die($?);
3760 + my $iaddr = inet_aton('localhost') || die "no host: localhost";
3761 + my $proto = getprotobyname('tcp');
3762 + socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
3763 + setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) || die "setsockopt: $!";
3764 + bind(SOCK, sockaddr_in($port, $iaddr)) || die "bind: $!";
3765 + listen(SOCK, 1024) || die "listen: $!";
3766 + dup2(fileno(SOCK), 0) || die "dup2: $!";
3767 + exec $binary or die($?);
3769 if (0 != $self->wait_for_port_with_proc($port, $child)) {
3770 diag(sprintf('The process %i is not up (port %i, %s)', $child, $port, $binary));
3772 ===================================================================
3773 --- configure.ac (.../tags/lighttpd-1.4.22) (revision 0)
3774 +++ configure.ac (.../branches/lighttpd-1.4.x) (revision 2505)
3777 +# Process this file with autoconf to produce a configure script.
3779 +AC_INIT([lighttpd], [1.4.23], [contact@lighttpd.net])
3780 +AC_CONFIG_SRCDIR([src/server.c])
3781 +AC_CONFIG_HEADER([config.h])
3783 +AC_CANONICAL_TARGET
3787 +# Checks for programs.
3798 +dnl check environment
3803 +dnl AC_CANONICAL_HOST
3805 + *darwin*|*cygwin*|*aix*|*mingw* ) NO_RDYNAMIC=yes;;
3806 + * ) NO_RDYNAMIC=no;;
3808 +AM_CONDITIONAL(NO_RDYNAMIC, test x$NO_RDYNAMIC = xyes)
3812 +dnl more automake stuff
3823 +CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__"
3825 +# Checks for header files.
3828 +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \
3829 +sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \
3830 +getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \
3831 +sys/mman.h sys/event.h sys/port.h pwd.h sys/syslimits.h \
3832 +sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h])
3834 +# Checks for typedefs, structures, and compiler characteristics.
3842 +AC_CHECK_MEMBER(struct tm.tm_gmtoff,[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm])],,[#include <time.h>])
3843 +AC_CHECK_TYPES(struct sockaddr_storage,,,[#include <sys/socket.h>])
3844 +AC_CHECK_TYPES(socklen_t,,,[#include <sys/types.h>
3845 +#include <sys/socket.h>])
3847 +# Checks for library functions.
3851 +dnl AC_FUNC_REALLOC
3855 +AC_CHECK_FUNCS([issetugid inet_pton])
3857 +dnl Checks for database.
3861 +AC_MSG_CHECKING(for MySQL support)
3863 + AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],[Include MySQL support. PATH is the path to 'mysql_config']),
3864 + [WITH_MYSQL=$withval],[WITH_MYSQL=no])
3866 +if test "$WITH_MYSQL" != "no"; then
3867 + AC_MSG_RESULT(yes)
3868 + if test "$WITH_MYSQL" = "yes"; then
3869 + AC_PATH_PROG(MYSQL_CONFIG, mysql_config)
3871 + MYSQL_CONFIG=$WITH_MYSQL
3874 + if test "$MYSQL_CONFIG" = ""; then
3875 + AC_MSG_ERROR(mysql_config is not found)
3877 + if test \! -x $MYSQL_CONFIG; then
3878 + AC_MSG_ERROR(mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config)
3881 + if $MYSQL_CONFIG | grep -- '--include' > /dev/null ; then
3882 + MYSQL_INCLUDE="`$MYSQL_CONFIG --include | sed s/\'//g`"
3884 + MYSQL_INCLUDE="`$MYSQL_CONFIG --cflags | sed s/\'//g`"
3886 + MYSQL_LIBS="`$MYSQL_CONFIG --libs | sed s/\'//g`"
3888 + AC_MSG_CHECKING(for MySQL includes at)
3889 + AC_MSG_RESULT($MYSQL_INCLUDE)
3891 + AC_MSG_CHECKING(for MySQL libraries at)
3892 + AC_MSG_RESULT($MYSQL_LIBS)
3893 +dnl check for errmsg.h, which isn't installed by some versions of 3.21
3894 + old_CPPFLAGS="$CPPFLAGS"
3895 + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
3896 + AC_CHECK_HEADERS(errmsg.h mysql.h)
3897 + CPPFLAGS="$old_CPPFLAGS"
3899 + AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
3904 +AC_SUBST(MYSQL_LIBS)
3905 +AC_SUBST(MYSQL_INCLUDE)
3908 +AC_MSG_CHECKING(for LDAP support)
3909 +AC_ARG_WITH(ldap, AC_HELP_STRING([--with-ldap],[enable LDAP support]),
3910 +[WITH_LDAP=$withval], [WITH_LDAP=no])
3911 +AC_MSG_RESULT([$withval])
3912 +if test "$WITH_LDAP" != "no"; then
3913 + AC_CHECK_LIB(ldap, ldap_bind, [
3914 + AC_CHECK_HEADERS([ldap.h],[
3916 + AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
3917 + AC_DEFINE([HAVE_LDAP_H], [1])
3918 + AC_DEFINE([LDAP_DEPRECATED], [1], [Using deprecated ldap api])
3921 + AC_SUBST(LDAP_LIB)
3922 + AC_CHECK_LIB(lber, ber_printf, [
3923 + AC_CHECK_HEADERS([lber.h],[
3925 + AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
3926 + AC_DEFINE([HAVE_LBER_H], [1])
3929 + AC_SUBST(LBER_LIB)
3932 +dnl Check for xattr
3933 +AC_MSG_CHECKING(for extended attributes support)
3934 +AC_ARG_WITH(attr, AC_HELP_STRING([--with-attr],[enable extended attribute support]),
3935 +[WITH_ATTR=$withval],[WITH_ATTR=no])
3936 +AC_MSG_RESULT($withval)
3937 +if test "$WITH_ATTR" != "no"; then
3938 + AC_CHECK_LIB(attr, attr_get, [
3939 + AC_CHECK_HEADERS([attr/attributes.h],[
3941 + AC_DEFINE([HAVE_XATTR], [1], [libattr])
3942 + AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
3945 + AC_SUBST(ATTR_LIB)
3948 +## openssl on solaris needs -lsocket -lnsl
3949 +AC_SEARCH_LIBS(socket,socket)
3950 +AC_SEARCH_LIBS(gethostbyname,nsl socket)
3951 +AC_SEARCH_LIBS(hstrerror,resolv)
3954 +AC_SEARCH_LIBS(dlopen,dl,[
3955 + AC_CHECK_HEADERS([dlfcn.h],[
3956 + if test "$ac_cv_search_dlopen" != no; then
3957 + test "$ac_cv_search_dlopen" = "none required" || DL_LIB="$ac_cv_search_dlopen"
3960 + AC_DEFINE([HAVE_LIBDL], [1], [libdl])
3961 + AC_DEFINE([HAVE_DLFCN_H], [1])
3967 +dnl Check for valgrind
3968 +AC_MSG_CHECKING(for valgrind)
3969 +AC_ARG_WITH(valgrind, AC_HELP_STRING([--with-valgrind],[enable internal support for valgrind]),
3970 +[WITH_VALGRIND=$withval],[WITH_VALGRIND=no])
3971 +AC_MSG_RESULT([$WITH_VALGRIND])
3972 +if test "$WITH_VALGRIND" != "no"; then
3973 + AC_CHECK_HEADERS([valgrind/valgrind.h])
3976 +dnl Check for openssl
3977 +AC_MSG_CHECKING(for OpenSSL)
3978 +AC_ARG_WITH(openssl,
3979 + AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],[Include openssl support (default no)]),
3980 + [WITH_OPENSSL=$withval],[WITH_OPENSSL=no])
3982 +if test "$WITH_OPENSSL" != "no"; then
3984 + if test "$WITH_OPENSSL" != "yes"; then
3985 + CPPFLAGS="$CPPFLAGS -I$WITH_OPENSSL/include"
3986 + LDFLAGS="$LDFLAGS -L$WITH_OPENSSL/lib"
3991 +AC_MSG_RESULT([$use_openssl])
3993 +AC_ARG_WITH(openssl-includes,
3994 + AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
3995 + [ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
3998 +AC_ARG_WITH(openssl-libs,
3999 + AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
4000 + [ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
4003 +AC_ARG_WITH(kerberos5,
4004 + AC_HELP_STRING([--with-kerberos5],[use Kerberos5 support with OpenSSL]),
4005 + [ use_kerberos=yes ], [use_kerberos=no]
4008 +if test "x$use_openssl" = "xyes"; then
4009 + if test "x$use_kerberos" != "xyes"; then
4010 + CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
4013 + AC_CHECK_HEADERS([openssl/ssl.h])
4015 + AC_CHECK_LIB(crypto, BIO_f_base64, [
4016 + AC_CHECK_LIB(ssl, SSL_new, [ SSL_LIB="-lssl -lcrypto"
4017 + AC_DEFINE(HAVE_LIBSSL, [], [Have libssl]) ], [], [ -lcrypto "$DL_LIB" ])
4023 +AC_MSG_CHECKING(for perl regular expressions support)
4024 +AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre],[Enable pcre support (default yes)]),
4025 + [WITH_PCRE=$withval],[WITH_PCRE=yes])
4026 +AC_MSG_RESULT([$WITH_PCRE])
4028 +if test "x$cross_compiling" = xno -a "$WITH_PCRE" != "no"; then
4029 + AC_PATH_PROG(PCRECONFIG, pcre-config)
4031 + if test x"$PCRECONFIG" != x; then
4032 + PCRE_LIB=`$PCRECONFIG --libs`
4033 + CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
4034 + AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
4035 + AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
4037 + AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
4043 +AC_MSG_CHECKING(for zlib support)
4044 +AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],[Enable zlib support for mod_compress]),
4045 + [WITH_ZLIB=$withval],[WITH_ZLIB=yes])
4046 +AC_MSG_RESULT([$WITH_ZLIB])
4048 +if test "$WITH_ZLIB" != "no"; then
4049 + AC_CHECK_LIB(z, deflate, [
4050 + AC_CHECK_HEADERS([zlib.h],[
4052 + AC_DEFINE([HAVE_LIBZ], [1], [libz])
4053 + AC_DEFINE([HAVE_ZLIB_H], [1])
4056 + if test x$Z_LIB = x; then
4057 + AC_MSG_ERROR([zlib-headers and/or libs where not found, install them or build with --without-zlib])
4062 +AC_MSG_CHECKING(for bzip2 support)
4063 +AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2],[Enable bzip2 support for mod_compress]),
4064 + [WITH_BZIP2=$withval],[WITH_BZIP2=yes])
4065 +AC_MSG_RESULT([$WITH_BZIP2])
4067 +if test "$WITH_BZIP2" != "no"; then
4068 + AC_CHECK_LIB(bz2, BZ2_bzCompress, [
4069 + AC_CHECK_HEADERS([bzlib.h],[
4071 + AC_DEFINE([HAVE_LIBBZ2], [1], [libbz2])
4072 + AC_DEFINE([HAVE_BZLIB_H], [1])
4075 + if test x$BZ_LIB = x; then
4076 + AC_MSG_ERROR([bzip2-headers and/or libs where not found, install them or build with --without-bzip2])
4081 +if test -z "$PKG_CONFIG"; then
4082 + AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
4085 +dnl Check for gamin
4086 +AC_MSG_CHECKING(for FAM)
4087 +AC_ARG_WITH(fam, AC_HELP_STRING([--with-fam],[fam/gamin for reducing number of stat() calls]),
4088 +[WITH_FAM=$withval],[WITH_FAM=no])
4089 +AC_MSG_RESULT([$WITH_FAM])
4091 +if test "$WITH_FAM" != "no"; then
4092 + AC_CHECK_LIB(fam, FAMOpen2, [
4093 + AC_CHECK_HEADERS([fam.h],[
4095 + AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
4096 + AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
4099 + if test "x$FAM_LIBS" = x; then
4100 + PKG_CHECK_MODULES(FAM, gamin >= 0.1.0, [
4101 + AC_DEFINE([HAVE_LIBFAM], [1], [libfam])
4102 + AC_DEFINE([HAVE_FAM_H], [1], [fam.h])
4107 + AC_CHECK_FUNCS([FAMNoExists])
4110 + if test x$FAM_LIBS = x; then
4111 + AC_MSG_ERROR([fam/gamin-headers and/or libs where not found, install them or build with --without-fam])
4115 +AC_MSG_CHECKING(for properties in mod_webdav)
4116 +AC_ARG_WITH(webdav-props, AC_HELP_STRING([--with-webdav-props],[properties in mod_webdav]),
4117 +[WITH_WEBDAV_PROPS=$withval],[WITH_WEBDAV_PROPS=no])
4118 +AC_MSG_RESULT([$WITH_WEBDAV_PROPS])
4120 +if test "$WITH_WEBDAV_PROPS" != "no"; then
4121 + PKG_CHECK_MODULES(XML, libxml-2.0, [
4122 + AC_DEFINE([HAVE_LIBXML2], [1], [libxml2])
4123 + AC_DEFINE([HAVE_LIBXML_H], [1], [libxml.h])
4125 + PKG_CHECK_MODULES(SQLITE, sqlite3, [
4126 + AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3])
4127 + AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h])
4130 + AC_MSG_CHECKING(for locks in mod_webdav)
4131 + AC_ARG_WITH(webdav-locks, AC_HELP_STRING([--with-webdav-locks],[locks in mod_webdav]),
4132 + [WITH_WEBDAV_LOCKS=$withval],[WITH_WEBDAV_LOCKS=no])
4133 + AC_MSG_RESULT([$WITH_WEBDAV_LOCKS])
4135 + if test "$WITH_WEBDAV_LOCKS" != "no"; then
4136 + AC_CHECK_LIB(uuid, uuid_unparse, [
4137 + AC_CHECK_HEADERS([uuid/uuid.h],[
4139 + AC_DEFINE([HAVE_UUID], [1], [libuuid])
4140 + AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available])
4146 +AC_SUBST(UUID_LIBS)
4149 +AC_MSG_CHECKING(for gdbm)
4150 +AC_ARG_WITH(gdbm, AC_HELP_STRING([--with-gdbm],[gdbm storage for mod_trigger_b4_dl]),
4151 +[WITH_GDBM=$withval],[WITH_GDBM=no])
4152 +AC_MSG_RESULT([$WITH_GDBM])
4154 +if test "$WITH_GDBM" != "no"; then
4155 + AC_CHECK_LIB(gdbm, gdbm_open, [
4156 + AC_CHECK_HEADERS([gdbm.h],[
4158 + AC_DEFINE([HAVE_GDBM], [1], [libgdbm])
4159 + AC_DEFINE([HAVE_GDBM_H], [1])
4162 + AC_SUBST(GDBM_LIB)
4165 +dnl Check for memcache
4166 +AC_MSG_CHECKING(for memcache)
4167 +AC_ARG_WITH(memcache, AC_HELP_STRING([--with-memcache],[memcached storage for mod_trigger_b4_dl]),
4168 +[WITH_MEMCACHE=$withval],[WITH_MEMCACHE=no])
4169 +AC_MSG_RESULT([$WITH_MEMCACHE])
4170 +if test "$WITH_MEMCACHE" != "no"; then
4171 + AC_CHECK_LIB(memcache, mc_new, [
4172 + AC_CHECK_HEADERS([memcache.h],[
4173 + MEMCACHE_LIB=-lmemcache
4174 + AC_DEFINE([HAVE_MEMCACHE], [1], [libmemcache])
4175 + AC_DEFINE([HAVE_MEMCACHE_H], [1], [memcache.h])
4178 + AC_SUBST(MEMCACHE_LIB)
4182 +AC_MSG_CHECKING(if lua-support is requested)
4183 +AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua engine for mod_cml]),
4184 +[WITH_LUA=$withval],[WITH_LUA=no])
4186 +AC_MSG_RESULT($WITH_LUA)
4187 +if test "$WITH_LUA" != "no"; then
4188 + if test "$WITH_LUA" = "yes"; then
4191 + PKG_CHECK_MODULES(LUA, $WITH_LUA >= 5.1, [
4192 + AC_DEFINE([HAVE_LUA], [1], [liblua])
4193 + AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
4195 + # for debian based systems
4196 + PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1, [
4197 + AC_DEFINE([HAVE_LUA], [1], [liblua])
4198 + AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
4202 + AC_SUBST(LUA_CFLAGS)
4203 + AC_SUBST(LUA_LIBS)
4207 +AC_SEARCH_LIBS(crypt,crypt,[
4208 + AC_CHECK_HEADERS([crypt.h],[
4209 + AC_DEFINE([HAVE_CRYPT_H], [1])
4212 + AC_DEFINE([HAVE_LIBCRYPT], [1], [libcrypt])
4213 + if test "$ac_cv_search_crypt" != no; then
4214 + test "$ac_cv_search_crypt" = "none required" || CRYPT_LIB="$ac_cv_search_crypt"
4218 +AC_SUBST(CRYPT_LIB)
4221 +AC_SEARCH_LIBS(sendfilev,sendfile,[
4222 + if test "$ac_cv_search_sendfilev" != no; then
4223 + test "$ac_cv_search_sendfilev" = "none required" || SENDFILE_LIB="$ac_cv_search_sendfilev"
4224 + AC_DEFINE([HAVE_SENDFILEV], [1], [solaris sendfilev])
4228 +AC_SUBST(SENDFILE_LIB)
4231 + *mingw* ) LIBS="$LIBS -lwsock32";;
4235 +AC_CHECK_FUNCS([dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \
4236 + strdup strerror strstr strtol sendfile getopt socket lstat \
4237 + gethostbyname poll sigtimedwait epoll_ctl getrlimit chroot \
4238 + getuid select signal pathconf madvise posix_fadvise posix_madvise \
4239 + writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r])
4241 +AC_MSG_CHECKING(for Large File System support)
4243 + AC_HELP_STRING([--enable-lfs],[Turn on Large File System (default)]),
4244 + [case "${enableval}" in
4245 + yes) CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES" ;;
4247 + *) AC_MSG_ERROR(bad value ${enableval} for --enable-lfs) ;;
4248 + esac],[CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES"
4250 +AC_MSG_RESULT($enableval)
4252 +AC_CHECK_SIZEOF(long)
4253 +AC_CHECK_SIZEOF(off_t)
4255 +if test "x$ac_cv_func_sendfile" = xyes; then
4256 + # check if sendfile works
4257 + AC_MSG_CHECKING(if sendfile works)
4258 + if test "x$cross_compiling" = xno; then
4260 + #ifdef HAVE_SYS_SENDFILE_H
4261 + #include <sys/sendfile.h>
4262 + #endif /* HAVE_SYS_SENDFILE_H */
4263 + #include <errno.h>
4266 + if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1;
4269 + AC_MSG_RESULT(yes),
4270 + [ AC_MSG_RESULT(no)
4271 + AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) ] )
4273 + AC_MSG_RESULT(no, cross-compiling)
4274 + AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile])
4278 +dnl Check for IPv6 support
4280 +AC_ARG_ENABLE(ipv6,
4281 + AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
4282 + [case "${enableval}" in
4285 + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
4286 + esac],[ipv6=true])
4288 +if test x$ipv6 = xtrue; then
4289 + AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
4290 + [AC_TRY_LINK([ #include <sys/types.h>
4291 +#include <sys/socket.h>
4292 +#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ],
4293 + [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
4295 + if test "$ac_cv_ipv6_support" = yes; then
4296 + AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
4301 +AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
4303 +dnl check for fastcgi lib, for the tests only
4305 +AC_CHECK_LIB(fcgi, FCGI_Accept, [
4306 + AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h],[
4311 +AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_found" = xyes)
4314 +# check for extra compiler options (warning options)
4315 +if test "${GCC}" = "yes"; then
4316 + CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99"
4319 +AC_ARG_ENABLE(extra-warnings,
4320 + AC_HELP_STRING([--enable-extra-warnings],[enable extra warnings (gcc specific)]),
4321 + [case "${enableval}" in
4322 + yes) extrawarnings=true ;;
4323 + no) extrawarnings=false ;;
4324 + *) AC_MSG_ERROR(bad value ${enableval} for --enable-extra-warnings) ;;
4325 + esac],[extrawarnings=false])
4327 +if test x$extrawarnings = xtrue; then
4328 + 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"
4331 +dnl build version-id
4332 +LIGHTTPD_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'`
4333 +AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id])
4335 +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile \
4336 + tests/docroot/Makefile \
4337 + tests/docroot/123/Makefile \
4338 + tests/docroot/www/Makefile \
4339 + tests/docroot/www/go/Makefile \
4340 + tests/docroot/www/indexfile/Makefile \
4341 + tests/docroot/www/expire/Makefile \
4346 +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"
4347 +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"
4349 +plugins="mod_rewrite mod_redirect mod_ssi mod_trigger_b4_dl"
4350 +features="regex-conditionals"
4351 +if test ! "x$PCRE_LIB" = x; then
4352 + do_build="$do_build $plugins"
4353 + enable_feature="$features"
4355 + no_build="$no_build $plugins"
4356 + disable_feature="$features"
4359 +plugins="mod_mysql_vhost"
4360 +if test ! "x$MYSQL_LIBS" = x; then
4361 + do_build="$do_build $plugins"
4363 + no_build="$no_build $plugins"
4366 +plugins="mod_cml mod_magnet"
4367 +if test ! "x$LUA_LIBS" = x; then
4368 + do_build="$do_build $plugins"
4370 + no_build="$no_build $plugins"
4373 +features="storage-gdbm"
4374 +if test ! "x$GDBM_LIB" = x; then
4375 + enable_feature="$enable_feature $features"
4377 + disable_feature="$disable_feature $features"
4380 +features="storage-memcache"
4381 +if test ! "x$MEMCACHE_LIB" = x; then
4382 + enable_feature="$enable_feature $features"
4384 + disable_feature="$disable_feature $features"
4387 +features="compress-gzip compress-deflate"
4388 +if test ! "x$Z_LIB" = x; then
4389 + enable_feature="$enable_feature $features"
4391 + disable_feature="$disable_feature $features"
4394 +features="compress-bzip2"
4395 +if test ! "x$BZ_LIB" = x; then
4396 + enable_feature="$enable_feature $features"
4398 + disable_feature="$disable_feature $features"
4401 +features="auth-ldap"
4402 +if test ! "x$LDAP_LIB" = x; then
4403 + enable_feature="$enable_feature $features"
4405 + disable_feature="$disable_feature $features"
4408 +features="network-openssl"
4409 +if test ! "x$SSL_LIB" = x; then
4410 + enable_feature="$enable_feature $features"
4412 + disable_feature="$disable_feature $features"
4416 +features="auth-crypt"
4417 +if test "$ac_cv_search_crypt" = no; then
4418 + disable_feature="$disable_feature $features"
4420 + enable_feature="$enable_feature $features"
4423 +features="network-ipv6"
4424 +if test "$ac_cv_ipv6_support" = yes; then
4425 + enable_feature="$enable_feature $features"
4427 + disable_feature="$disable_feature $features"
4430 +features="large-files"
4431 +if test "$enable_lfs" = yes; then
4432 + enable_feature="$enable_feature $features"
4434 + disable_feature="$disable_feature $features"
4437 +features="stat-cache-fam"
4438 +if test ! "x$FAM_LIBS" = x; then
4439 + enable_feature="$enable_feature $features"
4441 + disable_feature="$disable_feature $features"
4444 +features="webdav-properties"
4445 +if test "x$XML_LIBS" \!= x -a "x$SQLITE_LIBS" \!= x; then
4446 + enable_feature="$enable_feature $features"
4448 + disable_feature="$disable_feature $features"
4451 +features="webdav-locks"
4452 +if test "x$UUID_LIBS" \!= x; then
4453 + enable_feature="$enable_feature $features"
4455 + disable_feature="$disable_feature $features"
4466 +for p in $do_build; do
4471 +for p in $no_build; do
4480 +for p in $enable_feature; do
4485 +for p in $disable_feature; do
4490 Index: doc/lighttpd.1
4491 ===================================================================
4492 --- doc/lighttpd.1 (.../tags/lighttpd-1.4.22) (revision 2505)
4493 +++ doc/lighttpd.1 (.../branches/lighttpd-1.4.x) (revision 2505)
4495 -.TH LIGHTTPD 1 2003-12-21
4497 -lighttpd - a fast, secure and flexible webserver
4499 -lighttpd -D -f <configfile>
4502 -/etc/lighttpd/lighttpd.conf
4506 -HTTP-Authentification - Basic, Digest
4513 Index: doc/spawn-fcgi.1
4514 ===================================================================
4515 --- doc/spawn-fcgi.1 (.../tags/lighttpd-1.4.22) (revision 2505)
4516 +++ doc/spawn-fcgi.1 (.../branches/lighttpd-1.4.x) (revision 2505)
4518 -.TH SPAWNFCGI 1 2003-12-21
4520 -spawn-fcgi \- spawning FastCGI processes
4522 -spawn-fcgi -f <fastcgi-binary> [-p <port> | -s <socket>] [-C <num-of-php-procs>] [-c <chroot-dir>] [-u <username>] [-g <groupname>]
4526 -spawn-fcgi is used to spawn remote FastCGI processes.
4531 Index: doc/configuration.txt
4532 ===================================================================
4533 --- doc/configuration.txt (.../tags/lighttpd-1.4.22) (revision 2505)
4534 +++ doc/configuration.txt (.../branches/lighttpd-1.4.x) (revision 2505)
4535 @@ -281,6 +281,12 @@
4537 bind to the IPv6 socket
4539 +server.defer-accept
4540 + set TCP_DEFER_ACCEPT to the specified value on the socket if the value is > 0
4541 + and TCP_DEFER_ACCEPT is available on the platform (linux2.4+)
4546 set the string returned by the Server: response header
4548 Index: doc/lighttpd.8
4549 ===================================================================
4550 --- doc/lighttpd.8 (.../tags/lighttpd-1.4.22) (revision 0)
4551 +++ doc/lighttpd.8 (.../branches/lighttpd-1.4.x) (revision 2505)
4553 +.TH LIGHTTPD "8" "2009-03-07" "" ""
4556 +lighttpd \- a fast, secure and flexible web server
4559 +\fBlighttpd\fP [\fB\-ptDvVh\fP] \fB\-f\fP \fIconfigfile\fP [\fB\-m\fP \fImoduledir\fP]
4562 +\fBlighttpd\fP (pronounced 'lighty') is an advanced HTTP daemon that aims
4563 +to be secure, fast, compliant and very flexible. It has been optimized for
4564 +high performance. Its feature set includes, but is not limited to, FastCGI,
4565 +CGI, basic and digest HTTP authentication, output compression, URL rewriting.
4567 +This manual page only lists the command line arguments. For details
4568 +on how to configure \fBlighttpd\fP and its modules see the files in the
4572 +The following options are supported:
4574 +\fB\-f\ \fP \fIconfigfile\fP
4575 +Load configuration file \fIconfigfile\fP.
4577 +\fB\-m\ \fP \fImoduledir\fP
4580 +as the directory that contains modules, instead of the default.
4583 +Print the parsed configuration file in its internal form and exit.
4586 +Test the configuration file for syntax errors and exit.
4589 +Do not daemonize (go into background). The default is to daemonize.
4592 +Show version and exit.
4595 +Show compile-time features and exit.
4598 +Show a brief help message and exit.
4602 +/etc/lighttpd/lighttpd.conf
4603 +The standard location for the configuration file.
4605 +/var/run/lighttpd.pid
4606 +The standard location for the PID of the running \fBlighttpd\fP process.
4609 +Online Documentation: http://wiki.lighttpd.net/
4613 +\fIHypertext Transfer Protocol -- HTTP/1.1\fP, RFC 2616.
4615 +\fIHTTP Authentication: Basic and Digest Access Authentication\fP, RFC 2617.
4617 +\fIThe Common Gateway Interface Version 1.1\fP, RFC 3875.
4619 +\fIThe FastCGI specification\fP.
4622 +Jan Kneschke <jan@kneschke.de>
4623 Index: doc/evhost.txt
4624 ===================================================================
4625 --- doc/evhost.txt (.../tags/lighttpd-1.4.22) (revision 2505)
4626 +++ doc/evhost.txt (.../branches/lighttpd-1.4.x) (revision 2505)
4628 %2 => domain name without tld
4629 %3 => subdomain 1 name
4630 %4 => subdomain 2 name
4631 + %_ => the complete hostname (without port info)
4633 evhost.path-pattern = "/home/www/servers/%3/pages/"
4635 Index: doc/dirlisting.txt
4636 ===================================================================
4637 --- doc/dirlisting.txt (.../tags/lighttpd-1.4.22) (revision 2505)
4638 +++ doc/dirlisting.txt (.../branches/lighttpd-1.4.x) (revision 2505)
4642 dir-listing.encoding = "utf-8"
4644 +dir-listing.show-readme
4645 + shows README.txt after the dirlisting if it exists in the directory
4649 +dir-listing.hide-readme-file
4650 + hides README.txt in the dirlisting
4654 +dir-listing.show-header
4655 + shows HEADER.txt before the dirlisting if it exists in the directory
4659 +dir-listing.hide-header-file
4660 + hides HEADER.txt in the dirlisting
4664 +dir-listing.set-footer
4666 + Default: empty, uses server.tag instead
4668 +dir-listing.encode-readme
4669 + encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
4673 +dir-listing.encode-header
4674 + encodes all control characers, '&', '<', '>' and '\x7f' as &#x**;
4678 +dir-listing.auto-layout
4679 + Disable this if you want your own html header and footer; specify
4680 + them in HEADER.txt and README.txt
4682 + you have to enable dir-list.show-readme/header for this of course
4684 + .external-css and .set-footer will be ignored if this is disabled
4687 Index: doc/lighttpd.conf
4688 ===================================================================
4689 --- doc/lighttpd.conf (.../tags/lighttpd-1.4.22) (revision 2505)
4690 +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2505)
4696 # "mod_trigger_b4_dl",
4703 -## a static document-root, for virtual-hosting take look at the
4704 -## server.virtual-* options
4705 +## A static document-root. For virtual hosting take a look at the
4706 +## mod_simple_vhost module.
4707 server.document-root = "/srv/www/htdocs/"
4709 ## where to send error-messages to
4710 @@ -299,11 +298,6 @@
4711 # trigger-before-download.deny-url = "http://127.0.0.1/index.html"
4712 # trigger-before-download.trigger-timeout = 10
4715 -## don't forget to add index.cml to server.indexfiles
4716 -# cml.extension = ".cml"
4717 -# cml.memcache-hosts = ( "127.0.0.1:11211" )
4719 #### variable usage:
4720 ## variable name without "." is auto prefixed by "var." and becomes "var.bar"
4722 Index: doc/extforward.txt
4723 ===================================================================
4724 --- doc/extforward.txt (.../tags/lighttpd-1.4.22) (revision 2505)
4725 +++ doc/extforward.txt (.../branches/lighttpd-1.4.x) (revision 2505)
4732 extforward.forwarder = ("10.0.0.232" => "trust")
4734 - will translate ip addresses coming from 10.0.0.232 to real ip addresses extracted from X-Forwarded-For: HTTP request header.
4735 + 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.
4738 + Sets headers to search for finding the originl addresses.
4740 + Example (for use with a Zeus ZXTM loadbalancer): ::
4742 + extforward.headers = ("X-Cluster-Client-Ip")
4744 + Default: empty, results in searching for "X-Forwarded-For" and "Forwarded-For"
4749 Index: doc/Makefile.am
4750 ===================================================================
4751 --- doc/Makefile.am (.../tags/lighttpd-1.4.22) (revision 2505)
4752 +++ doc/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2505)
4754 -dist_man1_MANS=lighttpd.1 spawn-fcgi.1
4755 +dist_man8_MANS=lighttpd.8
4758 DOCS=accesslog.txt \
4759 authentication.txt \
4762 ===================================================================
4764 ===================================================================
4765 --- NEWS (.../tags/lighttpd-1.4.22) (revision 2505)
4766 +++ NEWS (.../branches/lighttpd-1.4.x) (revision 2505)
4773 + * Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)
4774 + * New lighttpd man page (moved it to section 8) (fixes #1875)
4775 + * Create rrd file for empty rrdfile in mod_rrdtool (#1788)
4776 + * Fix workaround for incorrect path info/scriptname if fastcgi prefix is "/" (fixes #729)
4777 + * Finally removed spawn-fcgi
4778 + * Allow xattr to overwrite mime type (fixes #1929)
4779 + * Remove link from errormsg about fastcgi apps (fixes #1942)
4780 + * Strip trailing dot from "Host:" header
4781 + * Remove the optional port info from SERVER_NAME (thx Mr_Bond)
4782 + * Fix mod_proxy RoundRobin (off by one problem if only one backend is up)
4783 + * Rename configure.in to configure.ac, with small cleanups (fixes #1932)
4784 + * Add proper SUID bit detection (fixes #416)
4785 + * Check for regular file in mod_cgi, so we don't try to start directories
4786 + * Include mmap.h from chunk.h to fix some problems with #define mmap mmap64 (fixes #1923)
4787 + * Add support for pipe logging for server.errorlog (fixes #296)
4788 + * Add revision number to package version for svn/git checkouts
4789 + * Use server.tag for SERVER_SOFTWARE if configured (fixes #357)
4790 + * Fix trailing zero char in REQUEST_URI after "strip-request-uri" in mod_fastcgi
4791 + * mod_magnet: Add env["request.remote-ip"] (fixes #1740)
4792 + * mod_magnet: Add env["request.path-info"]
4793 + * Change name/version separator back to "/" (affects every place where the version is printed)
4794 + * Fix bug with FastCGI request id overflow under high load; just use always id 1 as we don't use multiplexing. (thx jgray)
4795 + * Add some dirlisting enhancements (fixes #1458)
4796 + * Add option to enable TCP_DEFER_ACCEPT (fixes #1447)
4797 + * Limit amount of bytes read for one read-event (fixes #1070)
4798 + * Add evasive.silent option (fixes #1438)
4799 + * Make mod_extforward headers configurable (fixes #1545)
4800 + * Add '%_' pattern for complete hostname in mod_evhost (fixes #1737)
4801 + * Add IPv6 support to mod_proxy (fixes #1537)
4802 + * mod_ssi printenv: print cgi env, add environment vars to cgi env (fixes #1713)
4803 + * Fix error message if no auth backend was set
4804 + * Fix SERVER_NAME port stripping (fixes #1968)
4805 + * Fix x-sendfile 2gb limiting (fixes #1970)
4806 + * Fix mod_cgi environment keys mangling (fixes #1969)
4807 + * Fix workaround for incorrect path info/scriptname if scgi prefix is "/" (fixes #729)
4808 + * Fix max-age value in mod_expire for 'modification' (fixes #1978)
4809 + * Fix evasive.silent option (#1438)
4811 +- 1.4.22 - 2009-03-07
4812 * Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)
4813 * Fix default vhost in mod_simple_vhost (fixes #1905)
4814 * Handle EINTR in mod_rrdtool (fixes #604)
4815 Index: CMakeLists.txt
4816 ===================================================================
4818 Property changes on: .
4819 ___________________________________________________________________
4820 Modified: bzr:revision-info
4821 - timestamp: 2009-03-07 14:58:05.338000059 +0100
4822 committer: Stefan Bühler <stbuehler@web.de>
4824 branch-nick: lighttpd-1.4.x
4826 + timestamp: 2009-03-07 22:04:32.213999987 +0100
4827 committer: Stefan Bühler <stbuehler@web.de>
4829 branch-nick: lighttpd-1.4.x
4831 Modified: bzr:file-ids
4833 + doc/lighttpd.8 lighttpd.8-20090307205615-mc312p5ocjwthwte-1
4835 Modified: bzr:revision-id:v3-trunk0
4836 - 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
4837 1128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
4838 1129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
4839 1130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
4840 1131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
4841 1132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
4842 1133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
4843 1134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
4844 1135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
4845 1136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
4846 1137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
4847 1138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
4848 1139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
4849 1140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
4850 1141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
4851 1142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
4852 1143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
4853 1144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
4854 1145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
4855 1146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
4856 1147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
4857 1148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
4858 1149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
4859 1150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
4860 1151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
4861 1152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
4862 1153 stbuehler@web.de-20080812194728-fupt781o6q058unh
4863 1154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
4864 1155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
4865 1156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
4866 1157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
4867 1158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
4868 1159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
4869 1160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
4870 1161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
4871 1162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
4872 1163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
4873 1164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
4874 1165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
4875 1166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
4876 1167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
4877 1168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
4878 1169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
4879 1170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
4880 1171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
4881 1172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
4882 1173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
4883 1174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
4884 1175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
4885 1176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
4886 1177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
4887 1178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
4888 1179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
4889 1180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
4890 1181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
4891 1182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
4892 1183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
4893 1184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
4894 1185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
4895 1186 stbuehler@web.de-20081001200802-l5og517etnneitk0
4896 1188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
4897 1189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
4898 1191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
4899 1192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
4900 1193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
4901 1195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
4902 1196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
4903 1197 stbuehler@web.de-20081016121114-65quosenmso8frf8
4904 1198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
4905 1199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
4906 1200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
4907 1201 stbuehler@web.de-20081205233903-708beaujtf26gprx
4908 1202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
4909 1203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
4910 1204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
4911 1205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
4912 1206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
4913 1208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
4914 1209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
4915 1210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
4916 1211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
4917 1212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
4918 1213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
4919 1214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
4920 1215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
4921 1216 stbuehler@web.de-20090205105134-6i5key9439wspueq
4922 1217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
4923 1218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
4924 1219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
4925 1220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
4926 1221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
4927 1222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
4928 1223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
4929 1224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
4930 1225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
4931 1226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
4932 1227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
4933 1228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
4934 1229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
4935 1230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
4936 1231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
4937 1232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
4938 1233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
4939 1234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
4940 1235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
4941 1236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
4943 + 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
4944 1128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
4945 1129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
4946 1130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
4947 1131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
4948 1132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
4949 1133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
4950 1134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
4951 1135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
4952 1136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
4953 1137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
4954 1138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
4955 1139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
4956 1140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
4957 1141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
4958 1142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
4959 1143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
4960 1144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
4961 1145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
4962 1146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
4963 1147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
4964 1148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
4965 1149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
4966 1150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
4967 1151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
4968 1152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
4969 1153 stbuehler@web.de-20080812194728-fupt781o6q058unh
4970 1154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
4971 1155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
4972 1156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
4973 1157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
4974 1158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
4975 1159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
4976 1160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
4977 1161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
4978 1162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
4979 1163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
4980 1164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
4981 1165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
4982 1166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
4983 1167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
4984 1168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
4985 1169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
4986 1170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
4987 1171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
4988 1172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
4989 1173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
4990 1174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
4991 1175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
4992 1176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
4993 1177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
4994 1178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
4995 1179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
4996 1180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
4997 1181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
4998 1182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
4999 1183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
5000 1184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
5001 1185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
5002 1186 stbuehler@web.de-20081001200802-l5og517etnneitk0
5003 1188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
5004 1189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
5005 1191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
5006 1192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
5007 1193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
5008 1195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
5009 1196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
5010 1197 stbuehler@web.de-20081016121114-65quosenmso8frf8
5011 1198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
5012 1199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
5013 1200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
5014 1201 stbuehler@web.de-20081205233903-708beaujtf26gprx
5015 1202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
5016 1203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
5017 1204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
5018 1205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
5019 1206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
5020 1208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
5021 1209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
5022 1210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
5023 1211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
5024 1212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
5025 1213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
5026 1214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
5027 1215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
5028 1216 stbuehler@web.de-20090205105134-6i5key9439wspueq
5029 1217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
5030 1218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
5031 1219 stbuehler@web.de-20090205215425-vicbc6hzb3at7gj9
5032 1220 stbuehler@web.de-20090205220741-vqz9l1eui3dwnulq
5033 1221 stbuehler@web.de-20090205222705-8179v6jkv2x38l70
5034 1222 stbuehler@web.de-20090210194631-6epujtpen9xfxx5j
5035 1223 stbuehler@web.de-20090216134207-fg99ikt1ds21hx25
5036 1224 stbuehler@web.de-20090217085833-9g5c7j7zdylvezl5
5037 1225 stbuehler@web.de-20090217133414-y80hydn9raqgkgto
5038 1226 stbuehler@web.de-20090217224447-ve7ns45c9otbgz9h
5039 1227 stbuehler@web.de-20090219130703-117t93t4hr4j0e8d
5040 1228 stbuehler@web.de-20090219130728-m8nui64vin0w95b2
5041 1229 stbuehler@web.de-20090219131550-exi19tbqyd8fpa0d
5042 1230 stbuehler@web.de-20090224133046-toewpee0ybw5tuay
5043 1231 stbuehler@web.de-20090228205351-yqjhutdqf30jr66o
5044 1232 stbuehler@web.de-20090228213824-gnwuf6by8705g6zk
5045 1233 stbuehler@web.de-20090303100525-kamra70ocxpji0l5
5046 1234 stbuehler@web.de-20090303100929-p4w2995k61yhxws2
5047 1235 stbuehler@web.de-20090307135056-02q8f6l1e5jehu9y
5048 1236 stbuehler@web.de-20090307135805-z488kad68sgcjtzz
5049 1237 stbuehler@web.de-20090307154555-xybvl7sxrha6vhds
5050 1238 stbuehler@web.de-20090307204326-10m0681831yvhi3k
5051 1239 stbuehler@web.de-20090307204846-seq3cmzn6dy9927i
5052 1240 stbuehler@web.de-20090307205519-ha3s58fcum106yl0
5053 1241 stbuehler@web.de-20090307210432-jdlv5pp9m519vyv2