2 ===================================================================
3 Index: src/configfile-glue.c
4 ===================================================================
5 --- src/configfile-glue.c (.../tags/lighttpd-1.4.18) (revision 2061)
6 +++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2061)
11 + case COMP_HTTP_SCHEME:
12 + l = con->uri.scheme;
19 ===================================================================
20 --- src/base.h (.../tags/lighttpd-1.4.18) (revision 2061)
21 +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2061)
26 + unsigned short is_proxy_ssl;
31 ===================================================================
32 --- src/array.h (.../tags/lighttpd-1.4.18) (revision 2061)
33 +++ src/array.h (.../branches/lighttpd-1.4.x) (revision 2061)
37 COMP_HTTP_QUERYSTRING,
42 Index: src/mod_staticfile.c
43 ===================================================================
44 --- src/mod_staticfile.c (.../tags/lighttpd-1.4.18) (revision 2061)
45 +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2061)
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 2061)
75 +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2061)
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 2061)
91 +++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2061)
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_userdir.c
111 ===================================================================
112 --- src/mod_userdir.c (.../tags/lighttpd-1.4.18) (revision 2061)
113 +++ src/mod_userdir.c (.../branches/lighttpd-1.4.x) (revision 2061)
118 + unsigned short letterhomes;
123 { "userdir.exclude-user", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
124 { "userdir.include-user", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
125 { "userdir.basepath", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
126 + { "userdir.letterhomes", NULL, T_CONFIG_BOOLEAN,T_CONFIG_SCOPE_CONNECTION }, /* 4 */
127 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
130 @@ -102,11 +104,13 @@
131 s->include_user = array_init();
132 s->path = buffer_init();
133 s->basepath = buffer_init();
134 + s->letterhomes = 0;
136 cv[0].destination = s->path;
137 cv[1].destination = s->exclude_user;
138 cv[2].destination = s->include_user;
139 cv[3].destination = s->basepath;
140 + cv[4].destination = &(s->letterhomes);
142 p->config_storage[i] = s;
148 + PATCH(letterhomes);
150 /* skip the first, the global context */
151 for (i = 1; i < srv->config_context->used; i++) {
154 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.basepath"))) {
156 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.letterhomes"))) {
157 + PATCH(letterhomes);
163 buffer_copy_string_buffer(p->temp_path, p->conf.basepath);
164 BUFFER_APPEND_SLASH(p->temp_path);
165 + if (p->conf.letterhomes) {
166 + buffer_append_string_len(p->temp_path, p->username->ptr, 1);
167 + BUFFER_APPEND_SLASH(p->temp_path);
169 buffer_append_string_buffer(p->temp_path, p->username);
171 BUFFER_APPEND_SLASH(p->temp_path);
172 Index: src/mod_proxy.c
173 ===================================================================
174 --- src/mod_proxy.c (.../tags/lighttpd-1.4.18) (revision 2061)
175 +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2061)
176 @@ -1093,15 +1093,17 @@
177 if (s_len < ct_len) continue;
179 /* check extension in the form "/proxy_pattern" */
180 - if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
181 - if (s_len > ct_len + 1) {
183 + if (*(extension->key->ptr) == '/') {
184 + if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
185 + if (s_len > ct_len + 1) {
188 - if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
189 - path_info_offset = pi_offset - fn->ptr;
190 + if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
191 + path_info_offset = pi_offset - fn->ptr;
197 } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
198 /* check extension in the form ".fcg" */
200 Index: src/mod_extforward.c
201 ===================================================================
202 --- src/mod_extforward.c (.../tags/lighttpd-1.4.18) (revision 2061)
203 +++ src/mod_extforward.c (.../branches/lighttpd-1.4.x) (revision 2061)
206 * mod_extforward.c for lighttpd, by comman.kang <at> gmail <dot> com
207 * extended, modified by Lionel Elie Mamane (LEM), lionel <at> mamane <dot> lu
208 + * support chained proxies by glen@delfi.ee, #1528
213 * Note that "all" has precedence over specific entries,
214 * so "all except" setups will not work.
216 + * In case you have chained proxies, you can add all their IP's to the
217 + * config. However "all" has effect only on connecting IP, as the
218 + * X-Forwarded-For header can not be trusted.
220 * Note: The effect of this module is variable on $HTTP["remotip"] directives and
221 * other module's remote ip dependent actions.
222 * Things done by modules before we change the remoteip or after we reset it will match on the proxy's IP.
223 @@ -225,18 +230,16 @@
225 /* state variable, 0 means not in string, 1 means in string */
227 - for (base = pbuffer->ptr, curr = pbuffer->ptr; *curr; curr++)
229 + for (base = pbuffer->ptr, curr = pbuffer->ptr; *curr; curr++) {
231 - if ( (*curr > '9' || *curr < '0') && *curr != '.' && *curr != ':' ) {
232 + if ((*curr > '9' || *curr < '0') && *curr != '.' && *curr != ':') {
233 /* found an separator , insert value into result array */
234 - put_string_into_array_len(result, base, curr-base);
235 + put_string_into_array_len(result, base, curr - base);
236 /* change state to not in string */
240 - if (*curr >= '0' && *curr <= '9')
242 + if (*curr >= '0' && *curr <= '9') {
243 /* found leading char of an IP address, move base pointer and change state */
249 /* if breaking out while in str, we got to the end of string, so add it */
252 - put_string_into_array_len(result, base, curr-base);
254 + put_string_into_array_len(result, base, curr - base);
258 @@ -255,20 +257,42 @@
260 #define IP_UNTRUSTED 0
262 - check whether ip is trusted, return 1 for trusted , 0 for untrusted
264 + * check whether ip is trusted, return 1 for trusted , 0 for untrusted
266 static int is_proxy_trusted(const char *ipstr, plugin_data *p)
268 - data_string* allds = (data_string *) array_get_element(p->conf.forwarder,"all");
269 + data_string* allds = (data_string *)array_get_element(p->conf.forwarder, "all");
272 - if (strcasecmp(allds->value->ptr,"trust") == 0)
273 + if (strcasecmp(allds->value->ptr, "trust") == 0) {
280 - return (data_string *)array_get_element(p->conf.forwarder,ipstr) ? IP_TRUSTED : IP_UNTRUSTED ;
282 + return (data_string *)array_get_element(p->conf.forwarder, ipstr) ? IP_TRUSTED : IP_UNTRUSTED;
286 + * Return char *ip of last address of proxy that is not trusted.
287 + * Do not accept "all" keyword here.
289 +static const char *last_not_in_array(array *a, plugin_data *p)
291 + array *forwarder = p->conf.forwarder;
293 + for (int i = a->used - 1; i >= 0; i--) {
294 + data_string *ds = (data_string *)a->data[i];
295 + const char *ip = ds->value->ptr;
297 + if (!array_get_element(forwarder, ip)) {
304 struct addrinfo *ipstr_to_sockaddr(const char *host)
306 struct addrinfo hints, *res0;
308 struct addrinfo *addrlist = NULL;
310 const char *dst_addr_str = NULL;
312 array *forward_array = NULL;
313 - char *real_remote_addr = NULL;
314 + const char *real_remote_addr = NULL;
319 return HANDLER_GO_ON;
322 - /* if the remote ip itself is not trusted , then do nothing */
324 dst_addr_str = inet_ntop(con->dst_addr.plain.sa_family,
325 con->dst_addr.plain.sa_family == AF_INET6 ?
328 dst_addr_str = inet_ntoa(con->dst_addr.ipv4.sin_addr);
330 - if (IP_UNTRUSTED == is_proxy_trusted (dst_addr_str, p) ) {
332 + /* if the remote ip itself is not trusted, then do nothing */
333 + if (IP_UNTRUSTED == is_proxy_trusted(dst_addr_str, p)) {
334 if (con->conf.log_request_handling) {
335 log_error_write(srv, __FILE__, __LINE__, "s",
336 "remote address is NOT a trusted proxy, skipping");
337 @@ -362,40 +386,34 @@
338 return HANDLER_GO_ON;
341 + /* build forward_array from forwarded data_string */
342 forward_array = extract_forward_array(forwarded->value);
343 + real_remote_addr = last_not_in_array(forward_array, p);
345 - /* Testing shows that multiple headers and multiple values in one header
346 - come in _reverse_ order. So the first one we get is the last one in the request. */
347 - for (i = forward_array->used - 1; i >= 0; i--) {
348 - data_string *ds = (data_string *) forward_array->data[i];
350 - real_remote_addr = ds->value->ptr;
353 - /* bug ? bailing out here */
358 if (real_remote_addr != NULL) { /* parsed */
361 struct addrinfo *addrs_left;
362 + server_socket *srv_sock = con->srv_socket;
363 + data_string *forwarded_proto = (data_string *)array_get_element(con->request.headers, "X-Forwarded-Proto");
365 + if (forwarded_proto && !strcmp(forwarded_proto->value->ptr, "https")) {
366 + srv_sock->is_proxy_ssl = 1;
368 + srv_sock->is_proxy_ssl = 0;
371 if (con->conf.log_request_handling) {
372 - log_error_write(srv, __FILE__, __LINE__, "ss",
373 - "using address:", real_remote_addr);
374 + log_error_write(srv, __FILE__, __LINE__, "ss", "using address:", real_remote_addr);
377 addrlist = ipstr_to_sockaddr(real_remote_addr);
378 sock.plain.sa_family = AF_UNSPEC;
379 - for (addrs_left = addrlist; addrs_left != NULL;
380 - addrs_left = addrs_left -> ai_next) {
381 + for (addrs_left = addrlist; addrs_left != NULL; addrs_left = addrs_left -> ai_next) {
382 sock.plain.sa_family = addrs_left->ai_family;
383 - if ( sock.plain.sa_family == AF_INET ) {
384 + if (sock.plain.sa_family == AF_INET) {
385 sock.ipv4.sin_addr = ((struct sockaddr_in*)addrs_left->ai_addr)->sin_addr;
387 - } else if ( sock.plain.sa_family == AF_INET6 ) {
388 + } else if (sock.plain.sa_family == AF_INET6) {
389 sock.ipv6.sin6_addr = ((struct sockaddr_in6*)addrs_left->ai_addr)->sin6_addr;
393 if (addrlist != NULL ) freeaddrinfo(addrlist);
396 - array_free(forward_array);
397 + array_free(forward_array);
400 return HANDLER_GO_ON;
401 Index: src/Makefile.am
402 ===================================================================
403 --- src/Makefile.am (.../tags/lighttpd-1.4.18) (revision 2061)
404 +++ src/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2061)
408 noinst_HEADERS = $(hdr)
409 -EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c
410 +EXTRA_DIST = mod_skeleton.c configparser.y mod_ssi_exprparser.y lempar.c SConscript
411 Index: src/configparser.y
412 ===================================================================
413 --- src/configparser.y (.../tags/lighttpd-1.4.18) (revision 2061)
414 +++ src/configparser.y (.../branches/lighttpd-1.4.x) (revision 2061)
416 { COMP_HTTP_COOKIE, CONST_STR_LEN("HTTP[\"cookie\"]" ) },
417 { COMP_HTTP_REMOTEIP, CONST_STR_LEN("HTTP[\"remoteip\"]" ) },
418 { COMP_HTTP_QUERYSTRING, CONST_STR_LEN("HTTP[\"querystring\"]") },
419 + { COMP_HTTP_SCHEME, CONST_STR_LEN("HTTP[\"scheme\"]" ) },
420 { COMP_UNSET, NULL, 0 },
423 Index: src/mod_status.c
424 ===================================================================
425 --- src/mod_status.c (.../tags/lighttpd-1.4.18) (revision 2061)
426 +++ src/mod_status.c (.../branches/lighttpd-1.4.x) (revision 2061)
434 b = chunkqueue_get_append_buffer(con->write_queue);
437 buffer_append_long(b, srv->conns->used);
438 BUFFER_APPEND_STRING_CONST(b, "\n");
440 + BUFFER_APPEND_STRING_CONST(b, "IdleServers: ");
441 + buffer_append_long(b, srv->conns->size - srv->conns->used);
442 + BUFFER_APPEND_STRING_CONST(b, "\n");
444 + /* output scoreboard */
445 + BUFFER_APPEND_STRING_CONST(b, "Scoreboard: ");
446 + for (k = 0; k < srv->conns->used; k++) {
447 + connection *c = srv->conns->ptr[k];
448 + const char *state = connection_get_short_state(c->state);
449 + buffer_append_string_len(b, state, 1);
451 + for (l = 0; l < srv->conns->size - srv->conns->used; l++) {
452 + BUFFER_APPEND_STRING_CONST(b, "_");
454 + BUFFER_APPEND_STRING_CONST(b, "\n");
456 /* set text/plain output */
458 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/plain"));
460 ===================================================================
461 --- src/mod_ssi.c (.../tags/lighttpd-1.4.18) (revision 2061)
462 +++ src/mod_ssi.c (.../branches/lighttpd-1.4.x) (revision 2061)
464 #include <sys/filio.h>
469 +/* The newest modified time of included files for include statement */
470 +static volatile time_t include_file_last_mtime = 0;
472 /* init the plugin data */
473 INIT_FUNC(mod_ssi_init) {
478 chunkqueue_append_file(con->write_queue, p->stat_fn, 0, st.st_size);
480 + /* Keep the newest mtime of included files */
481 + if (st.st_mtime > include_file_last_mtime)
482 + include_file_last_mtime = st.st_mtime;
488 build_ssi_cgi_vars(srv, con, p);
491 + /* Reset the modified time of included files */
492 + include_file_last_mtime = 0;
494 if (-1 == stream_open(&s, con->physical.path)) {
495 log_error_write(srv, __FILE__, __LINE__, "sb",
496 "stream-open: ", con->physical.path);
497 @@ -1010,6 +1023,30 @@
499 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
502 + /* Generate "ETag" & "Last-Modified" headers */
504 + stat_cache_entry *sce = NULL;
505 + time_t lm_time = 0;
506 + buffer *mtime = NULL;
508 + stat_cache_get_entry(srv, con, con->physical.path, &sce);
510 + etag_mutate(con->physical.etag, sce->etag);
511 + response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
513 + if (sce->st.st_mtime > include_file_last_mtime)
514 + lm_time = sce->st.st_mtime;
516 + lm_time = include_file_last_mtime;
518 + mtime = strftime_cache_get(srv, lm_time);
519 + response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
522 + /* Reset the modified time of included files */
523 + include_file_last_mtime = 0;
525 /* reset physical.path */
526 buffer_reset(con->physical.path);
528 Index: src/spawn-fcgi.c
529 ===================================================================
530 --- src/spawn-fcgi.c (.../tags/lighttpd-1.4.18) (revision 2061)
531 +++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2061)
536 -int fcgi_spawn_connection(char *appPath, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
537 +int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
539 int socket_type, status;
540 struct timeval tv = { 0, 100 * 1000 };
541 @@ -137,11 +137,10 @@
549 - /* is save as we limit to 256 childs */
550 + /* is safe as we limit to 256 childs */
551 sprintf(cgi_childs, "PHP_FCGI_CHILDREN=%d", child_count);
553 if(fcgi_fd != FCGI_LISTENSOCK_FILENO) {
554 @@ -160,13 +159,18 @@
557 /* fork and replace shell */
558 - b = malloc(strlen("exec ") + strlen(appPath) + 1);
559 - strcpy(b, "exec ");
560 - strcat(b, appPath);
562 + execv(appArgv[0], appArgv);
565 - execl("/bin/sh", "sh", "-c", b, (char *)NULL);
567 + char *b = malloc(strlen("exec ") + strlen(appPath) + 1);
568 + strcpy(b, "exec ");
569 + strcat(b, appPath);
572 + execl("/bin/sh", "sh", "-c", b, (char *)NULL);
582 - char *b = "spawn-fcgi" "-" PACKAGE_VERSION \
583 -" - spawns fastcgi processes\n" \
586 +"Usage: spawn-fcgi [options] -- <fcgiapp> [fcgi app arguments]\n" \
588 +"spawn-fcgi v" PACKAGE_VERSION " - spawns fastcgi processes\n" \
591 " -f <fcgiapp> filename of the fcgi-application\n" \
592 " -a <addr> bind to ip address\n" \
593 " -p <port> bind to tcp-port\n" \
595 char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
596 *groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
598 + char **fcgi_app_argv = { NULL };
599 unsigned short port = 0;
604 i_am_root = (getuid() == 0);
606 - while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
607 + while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
609 case 'f': fcgi_app = optarg; break;
610 case 'a': addr = optarg;/* ip addr */ break;
615 - if (fcgi_app == NULL || (port == 0 && unixsocket == NULL)) {
616 + if (optind < argc) {
617 + fcgi_app_argv = &argv[optind];
620 + if ((fcgi_app == NULL && fcgi_app_argv == NULL) || (port == 0 && unixsocket == NULL)) {
629 + * Change group before chroot, when we have access
633 + setgid(grp->gr_gid);
634 + setgroups(0, NULL);
636 + initgroups(username, grp->gr_gid);
641 if (-1 == chroot(changeroot)) {
642 fprintf(stderr, "%s.%d: %s %s\n",
643 @@ -420,18 +444,12 @@
646 /* drop root privs */
648 - setgid(grp->gr_gid);
652 - initgroups(username, grp->gr_gid);
658 - return fcgi_spawn_connection(fcgi_app, addr, port, unixsocket, child_count, pid_fd, nofork);
659 + return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, child_count, pid_fd, nofork);
663 Index: src/mod_auth.c
664 ===================================================================
665 --- src/mod_auth.c (.../tags/lighttpd-1.4.18) (revision 2061)
666 +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2061)
667 @@ -238,13 +238,13 @@
668 int auth_type_len = auth_realm - http_authorization;
670 if ((auth_type_len == 5) &&
671 - (0 == strncmp(http_authorization, "Basic", auth_type_len))) {
672 + (0 == strncasecmp(http_authorization, "Basic", auth_type_len))) {
674 if (0 == strcmp(method->value->ptr, "basic")) {
675 auth_satisfied = http_auth_basic_check(srv, con, p, req, con->uri.path, auth_realm+1);
677 } else if ((auth_type_len == 6) &&
678 - (0 == strncmp(http_authorization, "Digest", auth_type_len))) {
679 + (0 == strncasecmp(http_authorization, "Digest", auth_type_len))) {
680 if (0 == strcmp(method->value->ptr, "digest")) {
681 if (-1 == (auth_satisfied = http_auth_digest_check(srv, con, p, req, con->uri.path, auth_realm+1))) {
682 con->http_status = 400;
683 Index: src/mod_fastcgi.c
684 ===================================================================
685 --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.18) (revision 2061)
686 +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2061)
688 * if host is one of the local IP adresses the
689 * whole connection is local
691 - * if tcp/ip should be used host AND port have
693 + * if port is not 0, and host is not specified,
694 + * "localhost" (INADDR_LOOPBACK) is assumed.
698 @@ -823,12 +823,12 @@
699 fcgi_addr_in.sin_family = AF_INET;
701 if (buffer_is_empty(host->host)) {
702 - fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
703 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
707 /* set a useful default */
708 - fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
709 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
712 if (NULL == (he = gethostbyname(host->host->ptr))) {
714 fcgi_addr = (struct sockaddr *) &fcgi_addr_in;
716 buffer_copy_string(proc->connection_name, "tcp:");
717 - buffer_append_string_buffer(proc->connection_name, host->host);
718 + if (!buffer_is_empty(host->host)) {
719 + buffer_append_string_buffer(proc->connection_name, host->host);
721 + buffer_append_string(proc->connection_name, "localhost");
723 buffer_append_string(proc->connection_name, ":");
724 buffer_append_long(proc->connection_name, proc->port);
726 @@ -1687,12 +1691,16 @@
729 fcgi_addr_in.sin_family = AF_INET;
730 - if (0 == inet_aton(host->host->ptr, &(fcgi_addr_in.sin_addr))) {
731 - log_error_write(srv, __FILE__, __LINE__, "sbs",
732 - "converting IP address failed for", host->host,
733 - "\nBe sure to specify an IP address here");
736 + if (!buffer_is_empty(host->host)) {
737 + if (0 == inet_aton(host->host->ptr, &(fcgi_addr_in.sin_addr))) {
738 + log_error_write(srv, __FILE__, __LINE__, "sbs",
739 + "converting IP address failed for", host->host,
740 + "\nBe sure to specify an IP address here");
745 + fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
747 fcgi_addr_in.sin_port = htons(proc->port);
748 servlen = sizeof(fcgi_addr_in);
749 @@ -1702,7 +1710,11 @@
750 if (buffer_is_empty(proc->connection_name)) {
751 /* on remote spawing we have to set the connection-name now */
752 buffer_copy_string(proc->connection_name, "tcp:");
753 - buffer_append_string_buffer(proc->connection_name, host->host);
754 + if (!buffer_is_empty(host->host)) {
755 + buffer_append_string_buffer(proc->connection_name, host->host);
757 + buffer_append_string(proc->connection_name, "localhost");
759 buffer_append_string(proc->connection_name, ":");
760 buffer_append_long(proc->connection_name, proc->port);
762 @@ -2045,13 +2057,10 @@
763 s = get_http_version_name(con->request.http_version);
764 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_PROTOCOL"), s, strlen(s)),con)
767 - if (srv_sock->is_ssl) {
768 + if (srv_sock->is_ssl || srv_sock->is_proxy_ssl) {
769 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("HTTPS"), CONST_STR_LEN("on")),con)
774 FCGI_ENV_ADD_CHECK(fcgi_env_add_request_headers(srv, con, p), con);
776 fcgi_header(&(header), FCGI_PARAMS, request_id, p->fcgi_env->used, 0);
777 @@ -2530,15 +2539,28 @@
780 if (host->allow_xsendfile &&
781 - NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))) {
782 + (NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))
783 + || NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-Sendfile")))) {
784 stat_cache_entry *sce;
786 if (HANDLER_ERROR != stat_cache_get_entry(srv, con, ds->value, &sce)) {
787 + data_string *dcls = data_string_init();
790 http_chunk_append_file(srv, con, ds->value, 0, sce->st.st_size);
791 hctx->send_content_body = 0; /* ignore the content */
792 joblist_append(srv, con);
794 + buffer_copy_string_len(dcls->key, "Content-Length", sizeof("Content-Length")-1);
795 + buffer_copy_long(dcls->value, sce->st.st_size);
796 + dcls = (data_string*) array_replace(con->response.headers, (data_unset *)dcls);
797 + if (dcls) dcls->free((data_unset*)dcls);
799 + con->parsed_response |= HTTP_CONTENT_LENGTH;
800 + con->response.content_length = sce->st.st_size;
802 + log_error_write(srv, __FILE__, __LINE__, "sb",
803 + "send-file error: couldn't get stat_cache entry for:",
808 @@ -2719,9 +2741,14 @@
816 + * - tcp socket (do not check host->host->uses, as it may be not set which means INADDR_LOOPBACK)
820 - ((!host->host->used || !host->port) && !host->unixsocket->used)) {
821 + (!host->port && !host->unixsocket->used)) {
822 log_error_write(srv, __FILE__, __LINE__, "sxddd",
825 @@ -3456,8 +3483,9 @@
826 if (s_len < ct_len) continue;
828 /* check extension in the form "/fcgi_pattern" */
829 - if (*(extension->key->ptr) == '/' && strncmp(fn->ptr, extension->key->ptr, ct_len) == 0) {
831 + if (*(extension->key->ptr) == '/') {
832 + if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
834 } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
835 /* check extension in the form ".fcg" */
837 @@ -3473,7 +3501,7 @@
838 for (k = 0; k < extension->used; k++) {
839 host = extension->hosts[k];
841 - /* we should have at least one proc that can do somthing */
842 + /* we should have at least one proc that can do something */
843 if (host->active_procs == 0) {
847 ===================================================================
848 --- src/server.c (.../tags/lighttpd-1.4.18) (revision 2061)
849 +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2061)
856 + * Change group before chroot, when we have access
859 + if (srv->srvconf.groupname->used) {
860 + setgid(grp->gr_gid);
861 + setgroups(0, NULL);
862 + if (srv->srvconf.username->used) {
863 + initgroups(srv->srvconf.username->ptr, grp->gr_gid);
868 if (srv->srvconf.changeroot->used) {
873 /* drop root privs */
874 - if (srv->srvconf.groupname->used) {
875 - setgid(grp->gr_gid);
876 - setgroups(0, NULL);
879 if (srv->srvconf.username->used) {
880 - if (srv->srvconf.groupname->used) {
881 - initgroups(srv->srvconf.username->ptr, grp->gr_gid);
890 + // Close stderr ASAP in the child process to make sure that nothing
891 + // is being written to that fd which may not be valid anymore.
892 + if (-1 == log_error_open(srv)) {
893 + log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
896 + network_close(srv);
901 if (HANDLER_GO_ON != plugins_call_set_defaults(srv)) {
902 log_error_write(srv, __FILE__, __LINE__, "s", "Configuration of plugins failed. Going down.");
908 - if (-1 == log_error_open(srv)) {
909 - log_error_write(srv, __FILE__, __LINE__, "s",
910 - "opening errorlog failed, dying");
913 - network_close(srv);
919 #ifdef HAVE_SIGACTION
920 Index: tests/mod-access.t
921 ===================================================================
922 --- tests/mod-access.t (.../tags/lighttpd-1.4.18) (revision 2061)
923 +++ tests/mod-access.t (.../branches/lighttpd-1.4.x) (revision 2061)
927 - # add current source dir to the include-path
928 - # we need this for make distcheck
929 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
930 - unshift @INC, $srcdir;
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;
938 Index: tests/mod-auth.t
939 ===================================================================
940 --- tests/mod-auth.t (.../tags/lighttpd-1.4.18) (revision 2061)
941 +++ tests/mod-auth.t (.../branches/lighttpd-1.4.x) (revision 2061)
945 - # add current source dir to the include-path
946 - # we need this for make distcheck
947 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
948 - unshift @INC, $srcdir;
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;
957 -use Test::More tests => 13;
958 +use Test::More tests => 14;
961 my $tf = LightyTest->new();
963 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
964 ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des)');
966 +$t->{REQUEST} = ( <<EOF
967 +GET /server-config HTTP/1.0
968 +Host: auth-htpasswd.example.org
969 +Authorization: basic ZGVzOmRlcw==
972 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
973 +ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des) (lowercase)');
977 skip "no md5 for crypt under cygwin", 1 if $^O eq 'cygwin';
978 $t->{REQUEST} = ( <<EOF
979 Index: tests/mod-secdownload.t
980 ===================================================================
981 Index: tests/core-response.t
982 ===================================================================
983 --- tests/core-response.t (.../tags/lighttpd-1.4.18) (revision 2061)
984 +++ tests/core-response.t (.../branches/lighttpd-1.4.x) (revision 2061)
989 - # add current source dir to the include-path
990 - # we need this for make distcheck
991 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
992 - unshift @INC, $srcdir;
993 + # add current source dir to the include-path
994 + # we need this for make distcheck
995 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
996 + unshift @INC, $srcdir;
1000 Index: tests/mod-extforward.conf
1001 ===================================================================
1002 --- tests/mod-extforward.conf (.../tags/lighttpd-1.4.18) (revision 0)
1003 +++ tests/mod-extforward.conf (.../branches/lighttpd-1.4.x) (revision 2061)
1005 +debug.log-request-handling = "enable"
1006 +debug.log-response-header = "disable"
1007 +debug.log-request-header = "disable"
1009 +server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
1010 +server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
1012 +## bind to port (default: 80)
1015 +## bind to localhost (default: all interfaces)
1016 +server.bind = "localhost"
1017 +server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
1018 +server.name = "www.example.org"
1019 +server.tag = "Apache 1.3.29"
1026 +######################## MODULE CONFIG ############################
1028 +mimetype.assign = ( ".html" => "text/html" )
1030 +cgi.assign = (".pl" => "/usr/bin/perl" )
1032 +extforward.forwarder = (
1033 + "127.0.0.1" => "trust",
1034 + "127.0.30.1" => "trust",
1036 Index: tests/symlink.t
1037 ===================================================================
1038 Index: tests/request.t
1039 ===================================================================
1040 --- tests/request.t (.../tags/lighttpd-1.4.18) (revision 2061)
1041 +++ tests/request.t (.../branches/lighttpd-1.4.x) (revision 2061)
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;
1049 + # add current source dir to the include-path
1050 + # we need this for make distcheck
1051 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1052 + unshift @INC, $srcdir;
1056 Index: tests/mod-userdir.t
1057 ===================================================================
1058 --- tests/mod-userdir.t (.../tags/lighttpd-1.4.18) (revision 2061)
1059 +++ tests/mod-userdir.t (.../branches/lighttpd-1.4.x) (revision 2061)
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;
1067 + # add current source dir to the include-path
1068 + # we need this for make distcheck
1069 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1070 + unshift @INC, $srcdir;
1074 Index: tests/core-keepalive.t
1075 ===================================================================
1076 --- tests/core-keepalive.t (.../tags/lighttpd-1.4.18) (revision 2061)
1077 +++ tests/core-keepalive.t (.../branches/lighttpd-1.4.x) (revision 2061)
1082 - # add current source dir to the include-path
1083 - # we need this for make distcheck
1084 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1085 - unshift @INC, $srcdir;
1086 + # add current source dir to the include-path
1087 + # we need this for make distcheck
1088 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1089 + unshift @INC, $srcdir;
1093 Index: tests/mod-proxy.t
1094 ===================================================================
1095 Index: tests/env-variables.t
1096 ===================================================================
1097 Index: tests/core-var-include.t
1098 ===================================================================
1099 --- tests/core-var-include.t (.../tags/lighttpd-1.4.18) (revision 2061)
1100 +++ tests/core-var-include.t (.../branches/lighttpd-1.4.x) (revision 2061)
1104 - # add current source dir to the include-path
1105 - # we need this for make distcheck
1106 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1107 - unshift @INC, $srcdir;
1108 + # add current source dir to the include-path
1109 + # we need this for make distcheck
1110 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1111 + unshift @INC, $srcdir;
1115 Index: tests/mod-extforward.t
1116 ===================================================================
1117 --- tests/mod-extforward.t (.../tags/lighttpd-1.4.18) (revision 0)
1118 +++ tests/mod-extforward.t (.../branches/lighttpd-1.4.x) (revision 2061)
1120 +#!/usr/bin/env perl
1122 + # add current source dir to the include-path
1123 + # we need this for make distcheck
1124 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1125 + unshift @INC, $srcdir;
1130 +use Test::More tests => 5;
1133 +my $tf = LightyTest->new();
1136 +$tf->{CONFIGFILE} = 'mod-extforward.conf';
1138 +ok($tf->start_proc == 0, "Starting lighttpd") or die();
1140 +$t->{REQUEST} = ( <<EOF
1141 +GET /ip.pl HTTP/1.0
1142 +Host: www.example.org
1143 +X-Forwarded-For: 127.0.10.1
1146 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '127.0.10.1' } ];
1147 +ok($tf->handle_http($t) == 0, 'expect 127.0.10.1, from single ip');
1149 +$t->{REQUEST} = ( <<EOF
1150 +GET /ip.pl HTTP/1.0
1151 +Host: www.example.org
1152 +X-Forwarded-For: 127.0.10.1, 127.0.20.1
1155 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '127.0.20.1' } ];
1156 +ok($tf->handle_http($t) == 0, 'expect 127.0.20.1, from two ips');
1158 +$t->{REQUEST} = ( <<EOF
1159 +GET /ip.pl HTTP/1.0
1160 +Host: www.example.org
1161 +X-Forwarded-For: 127.0.10.1, 127.0.20.1, 127.0.30.1
1164 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '127.0.20.1' } ];
1165 +ok($tf->handle_http($t) == 0, 'expect 127.0.20.1, from chained proxies');
1167 +ok($tf->stop_proc == 0, "Stopping lighttpd");
1169 Property changes on: tests/mod-extforward.t
1170 ___________________________________________________________________
1171 Name: svn:executable
1174 Index: tests/core-request.t
1175 ===================================================================
1176 --- tests/core-request.t (.../tags/lighttpd-1.4.18) (revision 2061)
1177 +++ tests/core-request.t (.../branches/lighttpd-1.4.x) (revision 2061)
1181 - # add current source dir to the include-path
1182 - # we need this for make distcheck
1183 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1184 - unshift @INC, $srcdir;
1185 + # add current source dir to the include-path
1186 + # we need this for make distcheck
1187 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1188 + unshift @INC, $srcdir;
1192 Index: tests/mod-redirect.t
1193 ===================================================================
1194 --- tests/mod-redirect.t (.../tags/lighttpd-1.4.18) (revision 2061)
1195 +++ tests/mod-redirect.t (.../branches/lighttpd-1.4.x) (revision 2061)
1199 - # add current source dir to the include-path
1200 - # we need this for make distcheck
1201 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1202 - unshift @INC, $srcdir;
1203 + # add current source dir to the include-path
1204 + # we need this for make distcheck
1205 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1206 + unshift @INC, $srcdir;
1210 Index: tests/mod-cgi.t
1211 ===================================================================
1212 --- tests/mod-cgi.t (.../tags/lighttpd-1.4.18) (revision 2061)
1213 +++ tests/mod-cgi.t (.../branches/lighttpd-1.4.x) (revision 2061)
1217 - # add current source dir to the include-path
1218 - # we need this for make distcheck
1219 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1220 - unshift @INC, $srcdir;
1221 + # add current source dir to the include-path
1222 + # we need this for make distcheck
1223 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1224 + unshift @INC, $srcdir;
1228 Index: tests/mod-setenv.t
1229 ===================================================================
1230 --- tests/mod-setenv.t (.../tags/lighttpd-1.4.18) (revision 2061)
1231 +++ tests/mod-setenv.t (.../branches/lighttpd-1.4.x) (revision 2061)
1236 - # add current source dir to the include-path
1237 - # we need this for make distcheck
1238 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1239 - unshift @INC, $srcdir;
1240 + # add current source dir to the include-path
1241 + # we need this for make distcheck
1242 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1243 + unshift @INC, $srcdir;
1247 Index: tests/cachable.t
1248 ===================================================================
1249 --- tests/cachable.t (.../tags/lighttpd-1.4.18) (revision 2061)
1250 +++ tests/cachable.t (.../branches/lighttpd-1.4.x) (revision 2061)
1254 - # add current source dir to the include-path
1255 - # we need this for make distcheck
1256 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1257 - unshift @INC, $srcdir;
1258 + # add current source dir to the include-path
1259 + # we need this for make distcheck
1260 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1261 + unshift @INC, $srcdir;
1265 Index: tests/lowercase.t
1266 ===================================================================
1267 --- tests/lowercase.t (.../tags/lighttpd-1.4.18) (revision 2061)
1268 +++ tests/lowercase.t (.../branches/lighttpd-1.4.x) (revision 2061)
1272 - # add current source dir to the include-path
1273 - # we need this for make distcheck
1274 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1275 - unshift @INC, $srcdir;
1276 + # add current source dir to the include-path
1277 + # we need this for make distcheck
1278 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1279 + unshift @INC, $srcdir;
1284 ===================================================================
1285 --- tests/core.t (.../tags/lighttpd-1.4.18) (revision 2061)
1286 +++ tests/core.t (.../branches/lighttpd-1.4.x) (revision 2061)
1291 - # add current source dir to the include-path
1292 - # we need this for make distcheck
1293 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1294 - unshift @INC, $srcdir;
1295 + # add current source dir to the include-path
1296 + # we need this for make distcheck
1297 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1298 + unshift @INC, $srcdir;
1302 Index: tests/mod-fastcgi.t
1303 ===================================================================
1304 --- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.18) (revision 2061)
1305 +++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2061)
1309 - # add current source dir to the include-path
1310 - # we need this for make distcheck
1311 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1312 - unshift @INC, $srcdir;
1313 + # add current source dir to the include-path
1314 + # we need this for make distcheck
1315 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1316 + unshift @INC, $srcdir;
1320 Index: tests/mod-rewrite.t
1321 ===================================================================
1322 --- tests/mod-rewrite.t (.../tags/lighttpd-1.4.18) (revision 2061)
1323 +++ tests/mod-rewrite.t (.../branches/lighttpd-1.4.x) (revision 2061)
1327 - # add current source dir to the include-path
1328 - # we need this for make distcheck
1329 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1330 - unshift @INC, $srcdir;
1331 + # add current source dir to the include-path
1332 + # we need this for make distcheck
1333 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1334 + unshift @INC, $srcdir;
1338 Index: tests/docroot/www/ip.pl
1339 ===================================================================
1340 --- tests/docroot/www/ip.pl (.../tags/lighttpd-1.4.18) (revision 0)
1341 +++ tests/docroot/www/ip.pl (.../branches/lighttpd-1.4.x) (revision 2061)
1344 +print "Content-Type: text/html\r\n\r\n";
1345 +print $ENV{'REMOTE_ADDR'};
1347 +if ($ENV{'QUERY_STRING'} eq 'info') {
1348 + print "\nF:",$ENV{'HTTP_X_FORWARDED_FOR'},"\n";
1350 + while (my($key, $value) = each %ENV) {
1351 + printf "%s => %s\n", $key, $value;
1357 Property changes on: tests/docroot/www/ip.pl
1358 ___________________________________________________________________
1359 Name: svn:executable
1362 Index: tests/Makefile.am
1363 ===================================================================
1364 --- tests/Makefile.am (.../tags/lighttpd-1.4.18) (revision 2061)
1365 +++ tests/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2061)
1372 + mod-secdownload.t \
1383 + env-variables.conf \
1389 core-404-handler.t \
1393 TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir)
1395 EXTRA_DIST=wrapper.sh lighttpd.conf \
1402 Index: tests/core-404-handler.t
1403 ===================================================================
1404 --- tests/core-404-handler.t (.../tags/lighttpd-1.4.18) (revision 2061)
1405 +++ tests/core-404-handler.t (.../branches/lighttpd-1.4.x) (revision 2061)
1407 # returning no status -> 200
1410 - # add current source dir to the include-path
1411 - # we need this for make distcheck
1412 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1413 - unshift @INC, $srcdir;
1414 + # add current source dir to the include-path
1415 + # we need this for make distcheck
1416 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1417 + unshift @INC, $srcdir;
1421 Index: tests/mod-compress.t
1422 ===================================================================
1423 --- tests/mod-compress.t (.../tags/lighttpd-1.4.18) (revision 2061)
1424 +++ tests/mod-compress.t (.../branches/lighttpd-1.4.x) (revision 2061)
1428 - # add current source dir to the include-path
1429 - # we need this for make distcheck
1430 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1431 - unshift @INC, $srcdir;
1432 + # add current source dir to the include-path
1433 + # we need this for make distcheck
1434 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1435 + unshift @INC, $srcdir;
1439 Index: tests/mod-ssi.t
1440 ===================================================================
1441 --- tests/mod-ssi.t (.../tags/lighttpd-1.4.18) (revision 2061)
1442 +++ tests/mod-ssi.t (.../branches/lighttpd-1.4.x) (revision 2061)
1446 - # add current source dir to the include-path
1447 - # we need this for make distcheck
1448 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1449 - unshift @INC, $srcdir;
1450 + # add current source dir to the include-path
1451 + # we need this for make distcheck
1452 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1453 + unshift @INC, $srcdir;
1457 Index: tests/core-condition.t
1458 ===================================================================
1459 --- tests/core-condition.t (.../tags/lighttpd-1.4.18) (revision 2061)
1460 +++ tests/core-condition.t (.../branches/lighttpd-1.4.x) (revision 2061)
1464 - # add current source dir to the include-path
1465 - # we need this for make distcheck
1466 - (my $srcdir = $0) =~ s#/[^/]+$#/#;
1467 - unshift @INC, $srcdir;
1468 + # add current source dir to the include-path
1469 + # we need this for make distcheck
1470 + (my $srcdir = $0) =~ s,/[^/]+$,/,;
1471 + unshift @INC, $srcdir;
1475 Index: doc/configuration.txt
1476 ===================================================================
1477 --- doc/configuration.txt (.../tags/lighttpd-1.4.18) (revision 2061)
1478 +++ doc/configuration.txt (.../branches/lighttpd-1.4.x) (revision 2061)
1488 Index: doc/lighttpd.conf
1489 ===================================================================
1490 --- doc/lighttpd.conf (.../tags/lighttpd-1.4.18) (revision 2061)
1491 +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2061)
1493 ".ogg" => "application/ogg",
1494 ".wav" => "audio/x-wav",
1495 ".gif" => "image/gif",
1496 + ".jar" => "application/x-java-archive",
1497 ".jpg" => "image/jpeg",
1498 ".jpeg" => "image/jpeg",
1499 ".png" => "image/png",
1501 ===================================================================
1503 ===================================================================
1504 --- Makefile.am (.../tags/lighttpd-1.4.18) (revision 2061)
1505 +++ Makefile.am (.../branches/lighttpd-1.4.x) (revision 2061)
1507 SUBDIRS=src doc tests cygwin openwrt
1509 -EXTRA_DIST=lighttpd.spec
1510 +EXTRA_DIST=lighttpd.spec autogen.sh SConstruct
1512 ===================================================================
1513 --- NEWS (.../tags/lighttpd-1.4.18) (revision 2061)
1514 +++ NEWS (.../branches/lighttpd-1.4.x) (revision 2061)
1521 + * added support for If-Range: <date> (#1346)
1522 + * added support for matching $HTTP["scheme"] in configs
1523 + * fixed initgroups() called after chroot (#1384)
1524 + * fixed case-sensitive check for Auth-Method (#1456)
1525 + * execute fcgi app without /bin/sh if used as argument to spawn-fcgi (#1428)
1526 + * fixed a bug that made /-prefixed extensions being handled also when
1527 + matching the end of the uri in fcgi,scgi and proxy modules (#1489)
1528 + * print error if X-LIGHTTPD-send-file cannot be done; reset header
1529 + Content-Length for send-file. Patches by Stefan Buhler
1530 + * prevent crash in certain php-fcgi configurations (#841)
1531 + * add IdleServers and Scoreboard directives in ?auto mode for mod_status (#1507)
1532 + * open log immediately after daemonizing, fixes SIGPIPEs on startup (#165)
1533 + * HTTPS env var should be "on" when using mod_extforward and the X-Forwarded-Proto header is set. (#1499)
1534 + * generate ETag and Last-Modified headers for mod_ssi based on newest modified include (#1491)
1535 + * support letterhomes in mod_userdir (#1473)
1536 + * support chained proxies in mod_extforward (#1528)
1538 - 1.4.18 - 2007-09-09
1540 * fixed compile error on IRIX 6.5.x on prctl() (#1333)
1541 Index: lighttpd.spec.in
1542 ===================================================================
1543 --- lighttpd.spec.in (.../tags/lighttpd-1.4.18) (revision 2061)
1544 +++ lighttpd.spec.in (.../branches/lighttpd-1.4.x) (revision 2061)
1546 Packager: Jan Kneschke <jan@kneschke.de>
1548 Group: Networking/Daemons
1549 -URL: http://jan.kneschke.de/projects/lighttpd/
1550 +URL: http://www.lighttpd.net/
1551 Requires: pcre >= 3.1 zlib
1552 -BuildPrereq: libtool zlib-devel
1553 +BuildRequires: libtool zlib-devel
1554 BuildRoot: %{_tmppath}/%{name}-root
1558 lighttpd is intented to be a frontend for ad-servers which have to deliver
1559 small files concurrently to many connections.
1561 -Available rpmbuild rebuild options :
1562 ---with : ssl mysql lua memcache
1563 +Available rpmbuild rebuild options:
1564 +--with: ssl mysql lua memcache
1578 mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
1579 -if test -f /etc/redhat-release -o -f /etc/fedora-release; then
1580 - install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
1581 +if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
1582 + install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
1584 - install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
1585 + install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
1587 install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
1592 ## read http://www.fedora.us/docs/spec.html next time :)
1593 -if test "$1" = "1"; then
1594 - # real install, not upgrade
1595 - /sbin/chkconfig --add lighttpd
1596 +if [ "$1" = "1" ]; then
1597 + # real install, not upgrade
1598 + /sbin/chkconfig --add lighttpd
1602 -if test "$1" = "0"; then
1603 - # real uninstall, not upgrade
1604 - %{_sysconfdir}/init.d/lighttpd stop
1605 - /sbin/chkconfig --del lighttpd
1606 +if [ "$1" = "0"]; then
1607 + # real uninstall, not upgrade
1608 + %{_sysconfdir}/init.d/lighttpd stop
1609 + /sbin/chkconfig --del lighttpd