2 ===================================================================
3 Index: src/configfile-glue.c
4 ===================================================================
5 --- src/configfile-glue.c (.../tags/lighttpd-1.4.18) (revision 2054)
6 +++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2054)
11 + case COMP_HTTP_SCHEME:
12 + l = con->uri.scheme;
19 ===================================================================
20 --- src/base.h (.../tags/lighttpd-1.4.18) (revision 2054)
21 +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2054)
26 + unsigned short is_proxy_ssl;
31 ===================================================================
32 --- src/array.h (.../tags/lighttpd-1.4.18) (revision 2054)
33 +++ src/array.h (.../branches/lighttpd-1.4.x) (revision 2054)
37 COMP_HTTP_QUERYSTRING,
42 Index: src/mod_staticfile.c
43 ===================================================================
44 --- src/mod_staticfile.c (.../tags/lighttpd-1.4.18) (revision 2054)
45 +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2054)
47 /* if the value is the same as our ETag, we do a Range-request,
48 * otherwise a full 200 */
50 - if (!buffer_is_equal(ds->value, con->physical.etag)) {
51 + if (ds->value->ptr[0] == '"') {
53 + * client wants a ETag
55 + if (!con->physical.etag) {
56 + do_range_request = 0;
57 + } else if (!buffer_is_equal(ds->value, con->physical.etag)) {
58 + do_range_request = 0;
60 + } else if (!mtime) {
62 + * we don't have a Last-Modified and can match the If-Range:
67 + } else if (!buffer_is_equal(ds->value, mtime)) {
68 + do_range_request = 0;
73 ===================================================================
74 --- src/mod_scgi.c (.../tags/lighttpd-1.4.18) (revision 2054)
75 +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2054)
77 if (s_len < ct_len) continue;
79 /* check extension in the form "/scgi_pattern" */
80 - if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
82 + if (*(extension->key->ptr) == '/') {
83 + if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
85 } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
86 /* check extension in the form ".fcg" */
89 ===================================================================
90 --- src/response.c (.../tags/lighttpd-1.4.18) (revision 2054)
91 +++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2054)
93 ds = (data_string *)con->response.headers->data[i];
95 if (ds->value->used && ds->key->used &&
96 - 0 != strncmp(ds->key->ptr, "X-LIGHTTPD-", sizeof("X-LIGHTTPD-") - 1)) {
97 + 0 != strncmp(ds->key->ptr, "X-LIGHTTPD-", sizeof("X-LIGHTTPD-") - 1) &&
98 + 0 != strncmp(ds->key->ptr, "X-Sendfile", sizeof("X-Sendfile") - 1)) {
99 if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Date"))) have_date = 1;
100 if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Server"))) have_server = 1;
103 buffer_copy_string_buffer(con->uri.authority, con->request.http_host);
104 buffer_to_lower(con->uri.authority);
106 + config_patch_connection(srv, con, COMP_HTTP_SCHEME); /* Scheme: */
107 config_patch_connection(srv, con, COMP_HTTP_HOST); /* Host: */
108 config_patch_connection(srv, con, COMP_HTTP_REMOTEIP); /* Client-IP */
109 config_patch_connection(srv, con, COMP_HTTP_REFERER); /* Referer: */
110 Index: src/mod_proxy.c
111 ===================================================================
112 --- src/mod_proxy.c (.../tags/lighttpd-1.4.18) (revision 2054)
113 +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2054)
114 @@ -1093,15 +1093,17 @@
115 if (s_len < ct_len) continue;
117 /* check extension in the form "/proxy_pattern" */
118 - if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
119 - if (s_len > ct_len + 1) {
121 + if (*(extension->key->ptr) == '/') {
122 + if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
123 + if (s_len > ct_len + 1) {
126 - if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
127 - path_info_offset = pi_offset - fn->ptr;
128 + if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
129 + path_info_offset = pi_offset - fn->ptr;
135 } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
136 /* check extension in the form ".fcg" */
138 Index: src/mod_extforward.c
139 ===================================================================
140 --- src/mod_extforward.c (.../tags/lighttpd-1.4.18) (revision 2054)
141 +++ src/mod_extforward.c (.../branches/lighttpd-1.4.x) (revision 2054)
144 if (real_remote_addr != NULL) { /* parsed */
147 struct addrinfo *addrs_left;
148 + server_socket *srv_sock = con->srv_socket;
149 + data_string *forwarded_proto = (data_string *) array_get_element(con->request.headers,"X-Forwarded-Proto");
151 + if (forwarded_proto && !strcmp(forwarded_proto->value->ptr, "https"))
152 + srv_sock->is_proxy_ssl = 1;
154 + srv_sock->is_proxy_ssl = 0;
156 if (con->conf.log_request_handling) {
157 log_error_write(srv, __FILE__, __LINE__, "ss",
158 "using address:", real_remote_addr);
159 Index: src/Makefile.am
160 ===================================================================
161 --- src/Makefile.am (.../tags/lighttpd-1.4.18) (revision 2054)
162 +++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2054)
166 noinst_HEADERS = $(hdr)
167 -EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c
168 +EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c SConscript
169 Index: src/configparser.y
170 ===================================================================
171 --- src/configparser.y (.../tags/lighttpd-1.4.18) (revision 2054)
172 +++ src/configparser.y (.../branches/lighttpd-1.4.x) (revision 2054)
174 { COMP_HTTP_COOKIE, CONST_STR_LEN("HTTP[\"cookie\"]" ) },
175 { COMP_HTTP_REMOTEIP, CONST_STR_LEN("HTTP[\"remoteip\"]" ) },
176 { COMP_HTTP_QUERYSTRING, CONST_STR_LEN("HTTP[\"querystring\"]") },
177 + { COMP_HTTP_SCHEME, CONST_STR_LEN("HTTP[\"scheme\"]" ) },
178 { COMP_UNSET, NULL, 0 },
181 Index: src/mod_status.c
182 ===================================================================
183 --- src/mod_status.c (.../tags/lighttpd-1.4.18) (revision 2054)
184 +++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2054)
192 b = chunkqueue_get_append_buffer(con->write_queue);
195 buffer_append_long(b, srv->conns->used);
196 BUFFER_APPEND_STRING_CONST(b, "\n");
198 + BUFFER_APPEND_STRING_CONST(b, "IdleServers: ");
199 + buffer_append_long(b, srv->conns->size - srv->conns->used);
200 + BUFFER_APPEND_STRING_CONST(b, "\n");
202 + /* output scoreboard */
203 + BUFFER_APPEND_STRING_CONST(b, "Scoreboard: ");
204 + for (k = 0; k < srv->conns->used; k++) {
205 + connection *c = srv->conns->ptr[k];
206 + const char *state = connection_get_short_state(c->state);
207 + buffer_append_string_len(b, state, 1);
209 + for (l = 0; l < srv->conns->size - srv->conns->used; l++) {
210 + BUFFER_APPEND_STRING_CONST(b, "_");
212 + BUFFER_APPEND_STRING_CONST(b, "\n");
214 /* set text/plain output */
216 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/plain"));
218 ===================================================================
219 --- src/mod_ssi.c (.../tags/lighttpd-1.4.18) (revision 2054)
220 +++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2054)
222 #include <sys/filio.h>
227 +/* The newest modified time of included files for include statement */
228 +static volatile time_t include_file_last_mtime = 0;
230 /* init the plugin data */
231 INIT_FUNC(mod_ssi_init) {
236 chunkqueue_append_file(con->write_queue, p->stat_fn, 0, st.st_size);
238 + /* Keep the newest mtime of included files */
239 + if (st.st_mtime > include_file_last_mtime)
240 + include_file_last_mtime = st.st_mtime;
246 build_ssi_cgi_vars(srv, con, p);
249 + /* Reset the modified time of included files */
250 + include_file_last_mtime = 0;
252 if (-1 == stream_open(&s, con->physical.path)) {
253 log_error_write(srv, __FILE__, __LINE__, "sb",
254 "stream-open: ", con->physical.path);
255 @@ -1010,6 +1023,30 @@
257 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
260 + /* Generate "ETag" & "Last-Modified" headers */
262 + stat_cache_entry *sce = NULL;
263 + time_t lm_time = 0;
264 + buffer *mtime = NULL;
266 + stat_cache_get_entry(srv, con, con->physical.path, &sce);
268 + etag_mutate(con->physical.etag, sce->etag);
269 + response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
271 + if (sce->st.st_mtime > include_file_last_mtime)
272 + lm_time = sce->st.st_mtime;
274 + lm_time = include_file_last_mtime;
276 + mtime = strftime_cache_get(srv, lm_time);
277 + response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
280 + /* Reset the modified time of included files */
281 + include_file_last_mtime = 0;
283 /* reset physical.path */
284 buffer_reset(con->physical.path);
286 Index: src/spawn-fcgi.c
287 ===================================================================
288 --- src/spawn-fcgi.c (.../tags/lighttpd-1.4.18) (revision 2054)
289 +++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2054)
294 -int fcgi_spawn_connection(char *appPath, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
295 +int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
297 int socket_type, status;
298 struct timeval tv = { 0, 100 * 1000 };
299 @@ -137,11 +137,10 @@
307 - /* is save as we limit to 256 childs */
308 + /* is safe as we limit to 256 childs */
309 sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
311 if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
312 @@ -160,13 +159,18 @@
315 /* fork and replace shell */
316 - b = malloc(strlen("exec ") + strlen(appPath) + 1);
317 - strcpy(b, "exec ");
318 - strcat(b, appPath);
320 + execv(appArgv[0], appArgv);
323 - execl("/bin/sh", "sh", "-c", b, (char *)NULL);
325 + char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
326 + strcpy(b, "exec ");
327 + strcat(b, appPath);
330 + execl("/bin/sh", "sh", "-c", b, (char *)NULL);
340 - char *b = "spawn-fcgi" "-" PACKAGE_VERSION \
341 -" - spawns fastcgi processes\n" \
344 +"Usage: spawn-fcgi [options] -- <fcgiapp> [fcgi app arguments]\n" \
346 +"spawn-fcgi v" PACKAGE_VERSION " - spawns fastcgi processes\n" \
349 " -f <fcgiapp> filename of the fcgi-application\n" \
350 " -a <addr> bind to ip address\n" \
351 " -p <port> bind to tcp-port\n" \
353 char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
354 *groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
356 + char **fcgi_app_argv = { NULL };
357 unsigned short port = 0;
362 i_am_root = (getuid() == 0);
364 - while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
365 + while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
367 case 'f': fcgi_app = optarg; break;
368 case 'a': addr = optarg;/* ip addr */ break;
373 - if (fcgi_app == NULL || (port == 0 && unixsocket == NULL)) {
374 + if (optind < argc) {
375 + fcgi_app_argv = &argv[optind];
378 + if ((fcgi_app == NULL && fcgi_app_argv == NULL) || (port == 0 && unixsocket == NULL)) {
387 + * Change group before chroot, when we have access
391 + setgid(grp->gr_gid);
392 + setgroups(0, NULL);
394 + initgroups(username, grp->gr_gid);
399 if (-1 == chroot(changeroot)) {
400 fprintf(stderr, "%s.%d: %s %s\n",
401 @@ -420,18 +444,12 @@
404 /* drop root privs */
406 - setgid(grp->gr_gid);
410 - initgroups(username, grp->gr_gid);
416 - return fcgi_spawn_connection(fcgi_app, addr, port, unixsocket, child_count, pid_fd, nofork);
417 + return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, child_count, pid_fd, nofork);
421 Index: src/mod_auth.c
422 ===================================================================
423 --- src/mod_auth.c (.../tags/lighttpd-1.4.18) (revision 2054)
424 +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2054)
425 @@ -238,13 +238,13 @@
426 int auth_type_len = auth_realm - http_authorization;
428 if ((auth_type_len == 5) &&
429 - (0 == strncmp(http_authorization, "Basic", auth_type_len))) {
430 + (0 == strncasecmp(http_authorization, "Basic", auth_type_len))) {
432 if (0 == strcmp(method->value->ptr, "basic")) {
433 auth_satisfied = http_auth_basic_check(srv, con, p, req, con->uri.path, auth_realm+1);
435 } else if ((auth_type_len == 6) &&
436 - (0 == strncmp(http_authorization, "Digest", auth_type_len))) {
437 + (0 == strncasecmp(http_authorization, "Digest", auth_type_len))) {
438 if (0 == strcmp(method->value->ptr, "digest")) {
439 if (-1 == (auth_satisfied = http_auth_digest_check(srv, con, p, req, con->uri.path, auth_realm+1))) {
440 con->http_status = 400;
441 Index: src/mod_fastcgi.c
442 ===================================================================
443 --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.18) (revision 2054)
444 +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2054)
446 * if host is one of the local IP adresses the
447 * whole connection is local
449 - * if tcp/ip should be used host AND port have
451 + * if port is not 0, and host is not specified,
452 + * "localhost" (INADDR_LOOPBACK) is assumed.
456 @@ -823,12 +823,12 @@
457 fcgi_addr_in.sin_family = AF_INET;
459 if (buffer_is_empty(host->host)) {
460 - fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
461 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
465 /* set a useful default */
466 - fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
467 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
470 if (NULL == (he = gethostbyname(host->host->ptr))) {
472 fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
474 buffer_copy_string(proc->connection_name, "tcp:");
475 - buffer_append_string_buffer(proc->connection_name, host->host);
476 + if (!buffer_is_empty(host->host)) {
477 + buffer_append_string_buffer(proc->connection_name, host->host);
479 + buffer_append_string(proc->connection_name, "localhost");
481 buffer_append_string(proc->connection_name, ":");
482 buffer_append_long(proc->connection_name, proc->port);
484 @@ -1687,12 +1691,16 @@
487 fcgi_addr_in.sin_family = AF_INET;
488 - if (0 == inet_aton(host->host->ptr, &(fcgi_addr_in.sin_addr))) {
489 - log_error_write(srv, __FILE__, __LINE__, "sbs",
490 - "converting IP address failed for", host->host,
491 - "\nBe sure to specify an IP address here");
494 + if (!buffer_is_empty(host->host)) {
495 + if (0 == inet_aton(host->host->ptr, &(fcgi_addr_in.sin_addr))) {
496 + log_error_write(srv, __FILE__, __LINE__, "sbs",
497 + "converting IP address failed for", host->host,
498 + "\nBe sure to specify an IP address here");
503 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
505 fcgi_addr_in.sin_port = htons(proc->port);
506 servlen = sizeof(fcgi_addr_in);
507 @@ -1702,7 +1710,11 @@
508 if (buffer_is_empty(proc->connection_name)) {
509 /* on remote spawing we have to set the connection-name now */
510 buffer_copy_string(proc->connection_name, "tcp:");
511 - buffer_append_string_buffer(proc->connection_name, host->host);
512 + if (!buffer_is_empty(host->host)) {
513 + buffer_append_string_buffer(proc->connection_name, host->host);
515 + buffer_append_string(proc->connection_name, "localhost");
517 buffer_append_string(proc->connection_name, ":");
518 buffer_append_long(proc->connection_name, proc->port);
520 @@ -2045,13 +2057,10 @@
521 s = get_http_version_name(con->request.http_version);
522 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_PROTOCOL"), s, strlen(s)),con)
525 - if (srv_sock->is_ssl) {
526 + if (srv_sock->is_ssl || srv_sock->is_proxy_ssl) {
527 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("HTTPS"), CONST_STR_LEN("on")),con)
532 FCGI_ENV_ADD_CHECK(fcgi_env_add_request_headers(srv, con, p), con);
534 fcgi_header(&(header), FCGI_PARAMS, request_id, p->fcgi_env->used, 0);
535 @@ -2530,15 +2539,28 @@
538 if (host->allow_xsendfile &&
539 - NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))) {
540 + (NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))
541 + || NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-Sendfile")))) {
542 stat_cache_entry *sce;
544 if (HANDLER_ERROR != stat_cache_get_entry(srv, con, ds->value, &sce)) {
545 + data_string *dcls = data_string_init();
548 http_chunk_append_file(srv, con, ds->value, 0, sce->st.st_size);
549 hctx->send_content_body = 0; /* ignore the content */
550 joblist_append(srv, con);
552 + buffer_copy_string_len(dcls->key, "Content-Length", sizeof("Content-Length")-1);
553 + buffer_copy_long(dcls->value, sce->st.st_size);
554 + dcls = (data_string*) array_replace(con->response.headers, (data_unset *)dcls);
555 + if (dcls) dcls->free((data_unset*)dcls);
557 + con->parsed_response |= HTTP_CONTENT_LENGTH;
558 + con->response.content_length = sce->st.st_size;
560 + log_error_write(srv, __FILE__, __LINE__, "sb",
561 + "send-file error: couldn't get stat_cache entry for:",
566 @@ -2719,9 +2741,14 @@
574 + * - tcp socket (do not check host->host->uses, as it may be not set which means INADDR_LOOPBACK)
578 - ((!host->host->used || !host->port) && !host->unixsocket->used)) {
579 + (!host->port && !host->unixsocket->used)) {
580 log_error_write(srv, __FILE__, __LINE__, "sxddd",
583 @@ -3456,8 +3483,9 @@
584 if (s_len < ct_len) continue;
586 /* check extension in the form "/fcgi_pattern" */
587 - if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
589 + if (*(extension->key->ptr) == '/') {
590 + if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
592 } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
593 /* check extension in the form ".fcg" */
595 @@ -3473,7 +3501,7 @@
596 for (k = 0; k < extension->used; k++) {
597 host = extension->hosts[k];
599 - /* we should have at least one proc that can do somthing */
600 + /* we should have at least one proc that can do something */
601 if (host->active_procs == 0) {
605 ===================================================================
606 --- src/server.c (.../tags/lighttpd-1.4.18) (revision 2054)
607 +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2054)
614 + * Change group before chroot, when we have access
617 + if (srv->srvconf.groupname->used) {
618 + setgid(grp->gr_gid);
619 + setgroups(0, NULL);
620 + if (srv->srvconf.username->used) {
621 + initgroups(srv->srvconf.username->ptr, grp->gr_gid);
626 if (srv->srvconf.changeroot->used) {
631 /* drop root privs */
632 - if (srv->srvconf.groupname->used) {
633 - setgid(grp->gr_gid);
634 - setgroups(0, NULL);
637 if (srv->srvconf.username->used) {
638 - if (srv->srvconf.groupname->used) {
639 - initgroups(srv->srvconf.username->ptr, grp->gr_gid);
648 + // Close stderr ASAP in the child process to make sure that nothing
649 + // is being written to that fd which may not be valid anymore.
650 + if (-1 == log_error_open(srv)) {
651 + log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
654 + network_close(srv);
659 if (HANDLER_GO_ON != plugins_call_set_defaults(srv)) {
660 log_error_write(srv, __FILE__, __LINE__, "s", "Configuration of plugins failed. Going down.");
666 - if (-1 == log_error_open(srv)) {
667 - log_error_write(srv, __FILE__, __LINE__, "s",
668 - "opening errorlog failed, dying");
671 - network_close(srv);
677 #ifdef HAVE_SIGACTION
678 Index: tests/mod-access.t
679 ===================================================================
680 --- tests/mod-access.t (.../tags/lighttpd-1.4.18) (revision 2054)
681 +++ tests/mod-access.t (.../branches/lighttpd-1.4.x) (revision 2054)
685 - # add current source dir to the include-path
686 - # we need this for make distcheck
687 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
688 - unshift @INC, $srcdir;
689 + # add current source dir to the include-path
690 + # we need this for make distcheck
691 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
692 + unshift @INC, $srcdir;
696 Index: tests/mod-auth.t
697 ===================================================================
698 --- tests/mod-auth.t (.../tags/lighttpd-1.4.18) (revision 2054)
699 +++ tests/mod-auth.t (.../branches/lighttpd-1.4.x) (revision 2054)
703 - # add current source dir to the include-path
704 - # we need this for make distcheck
705 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
706 - unshift @INC, $srcdir;
707 + # add current source dir to the include-path
708 + # we need this for make distcheck
709 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
710 + unshift @INC, $srcdir;
715 -use Test::More tests => 13;
716 +use Test::More tests => 14;
719 my $tf = LightyTest->new();
721 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
722 ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des)');
724 +$t->{REQUEST} = ( <<EOF
725 +GET /server-config HTTP/1.0
726 +Host: auth-htpasswd.example.org
727 +Authorization: basic ZGVzOmRlcw==
730 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
731 +ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des) (lowercase)');
735 skip "no md5 for crypt under cygwin", 1 if $^O eq 'cygwin';
736 $t->{REQUEST} = ( <<EOF
737 Index: tests/mod-secdownload.t
738 ===================================================================
739 Index: tests/core-response.t
740 ===================================================================
741 --- tests/core-response.t (.../tags/lighttpd-1.4.18) (revision 2054)
742 +++ tests/core-response.t (.../branches/lighttpd-1.4.x) (revision 2054)
747 - # add current source dir to the include-path
748 - # we need this for make distcheck
749 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
750 - unshift @INC, $srcdir;
751 + # add current source dir to the include-path
752 + # we need this for make distcheck
753 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
754 + unshift @INC, $srcdir;
758 Index: tests/mod-extforward.conf
759 ===================================================================
760 --- tests/mod-extforward.conf (.../tags/lighttpd-1.4.18) (revision 0)
761 +++ tests/mod-extforward.conf (.../branches/lighttpd-1.4.x) (revision 2054)
763 +debug.log-request-handling = "enable"
764 +debug.log-response-header = "enable"
765 +debug.log-request-header = "enable"
767 +server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
768 +server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
770 +## bind to port (default: 80)
773 +## bind to localhost (default: all interfaces)
774 +server.bind = "localhost"
775 +server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
776 +server.name = "www.example.org"
777 +server.tag = "Apache 1.3.29"
784 +######################## MODULE CONFIG ############################
786 +mimetype.assign = ( ".html" => "text/html" )
788 +cgi.assign = (".pl" => "/usr/bin/perl" )
790 +extforward.forwarder = (
791 + "127.0.0.1" => "trust",
793 Index: tests/symlink.t
794 ===================================================================
795 Index: tests/request.t
796 ===================================================================
797 --- tests/request.t (.../tags/lighttpd-1.4.18) (revision 2054)
798 +++ tests/request.t (.../branches/lighttpd-1.4.x) (revision 2054)
802 - # add current source dir to the include-path
803 - # we need this for make distcheck
804 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
805 - unshift @INC, $srcdir;
806 + # add current source dir to the include-path
807 + # we need this for make distcheck
808 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
809 + unshift @INC, $srcdir;
813 Index: tests/mod-userdir.t
814 ===================================================================
815 --- tests/mod-userdir.t (.../tags/lighttpd-1.4.18) (revision 2054)
816 +++ tests/mod-userdir.t (.../branches/lighttpd-1.4.x) (revision 2054)
820 - # add current source dir to the include-path
821 - # we need this for make distcheck
822 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
823 - unshift @INC, $srcdir;
824 + # add current source dir to the include-path
825 + # we need this for make distcheck
826 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
827 + unshift @INC, $srcdir;
831 Index: tests/core-keepalive.t
832 ===================================================================
833 --- tests/core-keepalive.t (.../tags/lighttpd-1.4.18) (revision 2054)
834 +++ tests/core-keepalive.t (.../branches/lighttpd-1.4.x) (revision 2054)
839 - # add current source dir to the include-path
840 - # we need this for make distcheck
841 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
842 - unshift @INC, $srcdir;
843 + # add current source dir to the include-path
844 + # we need this for make distcheck
845 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
846 + unshift @INC, $srcdir;
850 Index: tests/mod-proxy.t
851 ===================================================================
852 Index: tests/env-variables.t
853 ===================================================================
854 Index: tests/core-var-include.t
855 ===================================================================
856 --- tests/core-var-include.t (.../tags/lighttpd-1.4.18) (revision 2054)
857 +++ tests/core-var-include.t (.../branches/lighttpd-1.4.x) (revision 2054)
861 - # add current source dir to the include-path
862 - # we need this for make distcheck
863 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
864 - unshift @INC, $srcdir;
865 + # add current source dir to the include-path
866 + # we need this for make distcheck
867 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
868 + unshift @INC, $srcdir;
872 Index: tests/mod-extforward.t
873 ===================================================================
874 --- tests/mod-extforward.t (.../tags/lighttpd-1.4.18) (revision 0)
875 +++ tests/mod-extforward.t (.../branches/lighttpd-1.4.x) (revision 2054)
879 + # add current source dir to the include-path
880 + # we need this for make distcheck
881 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
882 + unshift @INC, $srcdir;
887 +use Test::More tests => 2;
890 +my $tf = LightyTest->new();
893 +$tf->{CONFIGFILE} = 'mod-extforward.conf';
895 +ok($tf->start_proc == 0, "Starting lighttpd") or die();
897 +## check if If-Modified-Since, If-None-Match works
899 +$t->{REQUEST} = ( <<EOF
901 +Host: www.example.org
902 +X-Forwarded-For: 127.0.10.1
905 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '127.0.10.1' } ];
906 +ok($tf->handle_http($t) == 0, 'expect 127.0.10.1');
908 +$t->{REQUEST} = ( <<EOF
910 +Host: www.example.org
911 +X-Forwarded-For: 127.0.10.1, 127.0.20.1
914 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '127.0.20.1' } ];
915 +ok($tf->handle_http($t) == 0, 'expect 127.0.20.1');
917 +ok($tf->stop_proc == 0, "Stopping lighttpd");
919 Property changes on: tests/mod-extforward.t
920 ___________________________________________________________________
924 Index: tests/core-request.t
925 ===================================================================
926 --- tests/core-request.t (.../tags/lighttpd-1.4.18) (revision 2054)
927 +++ tests/core-request.t (.../branches/lighttpd-1.4.x) (revision 2054)
931 - # add current source dir to the include-path
932 - # we need this for make distcheck
933 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
934 - unshift @INC, $srcdir;
935 + # add current source dir to the include-path
936 + # we need this for make distcheck
937 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
938 + unshift @INC, $srcdir;
942 Index: tests/mod-redirect.t
943 ===================================================================
944 --- tests/mod-redirect.t (.../tags/lighttpd-1.4.18) (revision 2054)
945 +++ tests/mod-redirect.t (.../branches/lighttpd-1.4.x) (revision 2054)
949 - # add current source dir to the include-path
950 - # we need this for make distcheck
951 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
952 - unshift @INC, $srcdir;
953 + # add current source dir to the include-path
954 + # we need this for make distcheck
955 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
956 + unshift @INC, $srcdir;
960 Index: tests/mod-cgi.t
961 ===================================================================
962 --- tests/mod-cgi.t (.../tags/lighttpd-1.4.18) (revision 2054)
963 +++ tests/mod-cgi.t (.../branches/lighttpd-1.4.x) (revision 2054)
967 - # add current source dir to the include-path
968 - # we need this for make distcheck
969 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
970 - unshift @INC, $srcdir;
971 + # add current source dir to the include-path
972 + # we need this for make distcheck
973 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
974 + unshift @INC, $srcdir;
978 Index: tests/mod-setenv.t
979 ===================================================================
980 --- tests/mod-setenv.t (.../tags/lighttpd-1.4.18) (revision 2054)
981 +++ tests/mod-setenv.t (.../branches/lighttpd-1.4.x) (revision 2054)
986 - # add current source dir to the include-path
987 - # we need this for make distcheck
988 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
989 - unshift @INC, $srcdir;
990 + # add current source dir to the include-path
991 + # we need this for make distcheck
992 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
993 + unshift @INC, $srcdir;
997 Index: tests/cachable.t
998 ===================================================================
999 --- tests/cachable.t (.../tags/lighttpd-1.4.18) (revision 2054)
1000 +++ tests/cachable.t (.../branches/lighttpd-1.4.x) (revision 2054)
1004 - # add current source dir to the include-path
1005 - # we need this for make distcheck
1006 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1007 - unshift @INC, $srcdir;
1008 + # add current source dir to the include-path
1009 + # we need this for make distcheck
1010 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1011 + unshift @INC, $srcdir;
1015 Index: tests/lowercase.t
1016 ===================================================================
1017 --- tests/lowercase.t (.../tags/lighttpd-1.4.18) (revision 2054)
1018 +++ tests/lowercase.t (.../branches/lighttpd-1.4.x) (revision 2054)
1022 - # add current source dir to the include-path
1023 - # we need this for make distcheck
1024 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1025 - unshift @INC, $srcdir;
1026 + # add current source dir to the include-path
1027 + # we need this for make distcheck
1028 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1029 + unshift @INC, $srcdir;
1034 ===================================================================
1035 --- tests/core.t (.../tags/lighttpd-1.4.18) (revision 2054)
1036 +++ tests/core.t (.../branches/lighttpd-1.4.x) (revision 2054)
1041 - # add current source dir to the include-path
1042 - # we need this for make distcheck
1043 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1044 - unshift @INC, $srcdir;
1045 + # add current source dir to the include-path
1046 + # we need this for make distcheck
1047 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1048 + unshift @INC, $srcdir;
1052 Index: tests/mod-fastcgi.t
1053 ===================================================================
1054 --- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.18) (revision 2054)
1055 +++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2054)
1059 - # add current source dir to the include-path
1060 - # we need this for make distcheck
1061 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1062 - unshift @INC, $srcdir;
1063 + # add current source dir to the include-path
1064 + # we need this for make distcheck
1065 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1066 + unshift @INC, $srcdir;
1070 Index: tests/mod-rewrite.t
1071 ===================================================================
1072 --- tests/mod-rewrite.t (.../tags/lighttpd-1.4.18) (revision 2054)
1073 +++ tests/mod-rewrite.t (.../branches/lighttpd-1.4.x) (revision 2054)
1077 - # add current source dir to the include-path
1078 - # we need this for make distcheck
1079 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1080 - unshift @INC, $srcdir;
1081 + # add current source dir to the include-path
1082 + # we need this for make distcheck
1083 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1084 + unshift @INC, $srcdir;
1088 Index: tests/docroot/www/ip.pl
1089 ===================================================================
1090 --- tests/docroot/www/ip.pl (.../tags/lighttpd-1.4.18) (revision 0)
1091 +++ tests/docroot/www/ip.pl (.../branches/lighttpd-1.4.x) (revision 2054)
1094 +print "Content-Type: text/html\r\n\r\n";
1095 +print $ENV{'REMOTE_ADDR'};
1099 Property changes on: tests/docroot/www/ip.pl
1100 ___________________________________________________________________
1101 Name: svn:executable
1104 Index: tests/Makefile.am
1105 ===================================================================
1106 --- tests/Makefile.am (.../tags/lighttpd-1.4.18) (revision 2054)
1107 +++ tests/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2054)
1114 + mod-secdownload.t \
1125 + env-variables.conf \
1131 core-404-handler.t \
1135 TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir)
1137 EXTRA_DIST=wrapper.sh lighttpd.conf \
1144 Index: tests/core-404-handler.t
1145 ===================================================================
1146 --- tests/core-404-handler.t (.../tags/lighttpd-1.4.18) (revision 2054)
1147 +++ tests/core-404-handler.t (.../branches/lighttpd-1.4.x) (revision 2054)
1149 # returning no status -> 200
1152 - # add current source dir to the include-path
1153 - # we need this for make distcheck
1154 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1155 - unshift @INC, $srcdir;
1156 + # add current source dir to the include-path
1157 + # we need this for make distcheck
1158 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1159 + unshift @INC, $srcdir;
1163 Index: tests/mod-compress.t
1164 ===================================================================
1165 --- tests/mod-compress.t (.../tags/lighttpd-1.4.18) (revision 2054)
1166 +++ tests/mod-compress.t (.../branches/lighttpd-1.4.x) (revision 2054)
1170 - # add current source dir to the include-path
1171 - # we need this for make distcheck
1172 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1173 - unshift @INC, $srcdir;
1174 + # add current source dir to the include-path
1175 + # we need this for make distcheck
1176 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1177 + unshift @INC, $srcdir;
1181 Index: tests/mod-ssi.t
1182 ===================================================================
1183 --- tests/mod-ssi.t (.../tags/lighttpd-1.4.18) (revision 2054)
1184 +++ tests/mod-ssi.t (.../branches/lighttpd-1.4.x) (revision 2054)
1188 - # add current source dir to the include-path
1189 - # we need this for make distcheck
1190 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1191 - unshift @INC, $srcdir;
1192 + # add current source dir to the include-path
1193 + # we need this for make distcheck
1194 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1195 + unshift @INC, $srcdir;
1199 Index: tests/core-condition.t
1200 ===================================================================
1201 --- tests/core-condition.t (.../tags/lighttpd-1.4.18) (revision 2054)
1202 +++ tests/core-condition.t (.../branches/lighttpd-1.4.x) (revision 2054)
1206 - # add current source dir to the include-path
1207 - # we need this for make distcheck
1208 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1209 - unshift @INC, $srcdir;
1210 + # add current source dir to the include-path
1211 + # we need this for make distcheck
1212 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1213 + unshift @INC, $srcdir;
1217 Index: doc/configuration.txt
1218 ===================================================================
1219 --- doc/configuration.txt (.../tags/lighttpd-1.4.18) (revision 2054)
1220 +++ doc/configuration.txt (.../branches/lighttpd-1.4.x) (revision 2054)
1230 Index: doc/lighttpd.conf
1231 ===================================================================
1232 --- doc/lighttpd.conf (.../tags/lighttpd-1.4.18) (revision 2054)
1233 +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2054)
1235 ".ogg" => "application/ogg",
1236 ".wav" => "audio/x-wav",
1237 ".gif" => "image/gif",
1238 + ".jar" => "application/x-java-archive",
1239 ".jpg" => "image/jpeg",
1240 ".jpeg" => "image/jpeg",
1241 ".png" => "image/png",
1243 ===================================================================
1245 ===================================================================
1246 --- Makefile.am (.../tags/lighttpd-1.4.18) (revision 2054)
1247 +++ Makefile.am (.../branches/lighttpd-1.4.x) (revision 2054)
1249 SUBDIRS=src doc tests cygwin openwrt
1251 -EXTRA_DIST=lighttpd.spec
1252 +EXTRA_DIST=lighttpd.spec autogen.sh SConstruct
1254 ===================================================================
1255 --- NEWS (.../tags/lighttpd-1.4.18) (revision 2054)
1256 +++ NEWS (.../branches/lighttpd-1.4.x) (revision 2054)
1263 + * added support for If-Range: <date> (#1346)
1264 + * added support for matching $HTTP["scheme"] in configs
1265 + * fixed initgroups() called after chroot (#1384)
1266 + * fixed case-sensitive check for Auth-Method (#1456)
1267 + * execute fcgi app without /bin/sh if used as argument to spawn-fcgi (#1428)
1268 + * fixed a bug that made /-prefixed extensions being handled also when
1269 + matching the end of the uri in fcgi,scgi and proxy modules (#1489)
1270 + * print error if X-LIGHTTPD-send-file cannot be done; reset header
1271 + Content-Length for send-file. Patches by Stefan Buhler
1272 + * prevent crash in certain php-fcgi configurations (#841)
1273 + * add IdleServers and Scoreboard directives in ?auto mode for mod_status (#1507)
1274 + * open log immediately after daemonizing, fixes SIGPIPEs on startup (#165)
1275 + * HTTPS env var should be "on" when using mod_extforward and the X-Forwarded-Proto header is set. (#1499)
1276 + * generate ETag and Last-Modified headers for mod_ssi based on newest modified include (#1491)
1278 - 1.4.18 - 2007-09-09
1280 * fixed compile error on IRIX 6.5.x on prctl() (#1333)
1281 Index: lighttpd.spec.in
1282 ===================================================================
1283 --- lighttpd.spec.in (.../tags/lighttpd-1.4.18) (revision 2054)
1284 +++ lighttpd.spec.in (.../branches/lighttpd-1.4.x) (revision 2054)
1286 Packager: Jan Kneschke <jan@kneschke.de>
1288 Group: Networking/Daemons
1289 -URL: http://jan.kneschke.de/projects/lighttpd/
1290 +URL: http://www.lighttpd.net/
1291 Requires: pcre >= 3.1 zlib
1292 -BuildPrereq: libtool zlib-devel
1293 +BuildRequires: libtool zlib-devel
1294 BuildRoot: %{_tmppath}/%{name}-root
1298 lighttpd is intented to be a frontend for ad-servers which have to deliver
1299 small files concurrently to many connections.
1301 -Available rpmbuild rebuild options :
1302 ---with : ssl mysql lua memcache
1303 +Available rpmbuild rebuild options:
1304 +--with: ssl mysql lua memcache
1318 mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
1319 -if test -f /etc/redhat-release -o -f /etc/fedora-release; then
1320 - install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
1321 +if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
1322 + install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
1324 - install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
1325 + install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
1327 install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
1332 ## read http://www.fedora.us/docs/spec.html next time :)
1333 -if test "$1" = "1"; then
1334 - # real install, not upgrade
1335 - /sbin/chkconfig --add lighttpd
1336 +if [ "$1" = "1" ]; then
1337 + # real install, not upgrade
1338 + /sbin/chkconfig --add lighttpd
1342 -if test "$1" = "0"; then
1343 - # real uninstall, not upgrade
1344 - %{_sysconfdir}/init.d/lighttpd stop
1345 - /sbin/chkconfig --del lighttpd
1346 +if [ "$1" = "0"]; then
1347 + # real uninstall, not upgrade
1348 + %{_sysconfdir}/init.d/lighttpd stop
1349 + /sbin/chkconfig --del lighttpd