Index: src/base.h =================================================================== --- src/base.h (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 1664) @@ -481,7 +481,9 @@ enum { STAT_CACHE_ENGINE_UNSET, STAT_CACHE_ENGINE_NONE, STAT_CACHE_ENGINE_SIMPLE, +#ifdef HAVE_FAM_H STAT_CACHE_ENGINE_FAM +#endif } stat_cache_engine; unsigned short enable_cores; } server_config; Index: src/connections.c =================================================================== --- src/connections.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -970,7 +970,7 @@ } } else { /* a splited \r \n */ - return -1; + break; } } } Index: src/configfile.c =================================================================== --- src/configfile.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -218,13 +218,19 @@ srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE; } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("simple"))) { srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE; +#ifdef HAVE_FAM_H } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("fam"))) { srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_FAM; +#endif } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("disable"))) { srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_NONE; } else { log_error_write(srv, __FILE__, __LINE__, "sb", - "server.stat-cache-engine can be one of \"disable\", \"simple\", \"fam\", but not:", stat_cache_string); + "server.stat-cache-engine can be one of \"disable\", \"simple\"," +#ifdef HAVE_FAM_H + " \"fam\"," +#endif + " but not:", stat_cache_string); ret = HANDLER_ERROR; } Index: src/mod_scgi.c =================================================================== --- src/mod_scgi.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -2528,7 +2528,7 @@ hctx->reconnects < 5) { scgi_reconnect(srv, hctx); - log_error_write(srv, __FILE__, __LINE__, "sdsdsd", + log_error_write(srv, __FILE__, __LINE__, "ssdsd", "response not sent, request not sent, reconnection.", "connection-fd:", con->fd, "fcgi-fd:", hctx->fd); Index: src/request.c =================================================================== --- src/request.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/request.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -85,6 +85,9 @@ /* Host is empty */ if (host_len == 0) return -1; + /* if the hostname ends in a "." strip it */ + if (host->ptr[host_len-1] == '.') host_len -= 1; + /* scan from the right and skip the \0 */ for (i = host_len - 1; i + 1 > 0; i--) { const char c = host->ptr[i]; Index: src/network_backends.h =================================================================== --- src/network_backends.h (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/network_backends.h (.../branches/lighttpd-1.4.x) (revision 1664) @@ -14,7 +14,7 @@ # include #endif -#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && defined(__FreeBSD__) +#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && (defined(__FreeBSD__) || defined(__DragonFly__)) # define USE_FREEBSD_SENDFILE # include #endif Index: src/mod_proxy.c =================================================================== --- src/mod_proxy.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -656,6 +656,7 @@ } if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) { + if (errno == EAGAIN) return 0; log_error_write(srv, __FILE__, __LINE__, "sds", "unexpected end-of-file (perhaps the proxy process died):", proxy_fd, strerror(errno)); Index: src/mod_expire.c =================================================================== --- src/mod_expire.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -85,7 +85,7 @@ /* * parse * - * '(access|modification) [plus] { }*' + * '(access|now|modification) [plus] { }*' * * e.g. 'access 1 years' */ @@ -101,6 +101,9 @@ if (0 == strncmp(ts, "access ", 7)) { type = 0; ts += 7; + } else if (0 == strncmp(ts, "now ", 4)) { + type = 0; + ts += 4; } else if (0 == strncmp(ts, "modification ", 13)) { type = 1; ts += 13; @@ -116,7 +119,7 @@ ts += 5; } - /* the rest is just (years|months|days|hours|minutes|seconds) */ + /* the rest is just (years|months|weeks|days|hours|minutes|seconds) */ while (1) { char *space, *err; int num; @@ -148,6 +151,9 @@ } else if (slen == 6 && 0 == strncmp(ts, "months", slen)) { num *= 60 * 60 * 24 * 30; + } else if (slen == 5 && + 0 == strncmp(ts, "weeks", slen)) { + num *= 60 * 60 * 24 * 7; } else if (slen == 4 && 0 == strncmp(ts, "days", slen)) { num *= 60 * 60 * 24; @@ -174,6 +180,8 @@ num *= 60 * 60 * 24 * 30 * 12; } else if (0 == strcmp(ts, "months")) { num *= 60 * 60 * 24 * 30; + } else if (0 == strcmp(ts, "weeks")) { + num *= 60 * 60 * 24 * 7; } else if (0 == strcmp(ts, "days")) { num *= 60 * 60 * 24; } else if (0 == strcmp(ts, "hours")) { Index: src/network_freebsd_sendfile.c =================================================================== --- src/network_freebsd_sendfile.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/network_freebsd_sendfile.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -25,7 +25,7 @@ #ifndef UIO_MAXIOV -# ifdef __FreeBSD__ +# if defined(__FreeBSD__) || defined(__DragonFly__) /* FreeBSD 4.7, 4.9 defined it in sys/uio.h only if _KERNEL is specified */ # define UIO_MAXIOV 1024 # endif Index: src/http_auth.c =================================================================== --- src/http_auth.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -733,8 +733,9 @@ } } + if (p->conf.auth_ldap_allow_empty_pw != 1 && pw[0] == '\0') + return -1; - /* build filter */ buffer_copy_string_buffer(p->ldap_filter, p->conf.ldap_filter_pre); buffer_append_string_buffer(p->ldap_filter, username); Index: src/http_auth.h =================================================================== --- src/http_auth.h (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/http_auth.h (.../branches/lighttpd-1.4.x) (revision 1664) @@ -36,6 +36,7 @@ buffer *auth_ldap_filter; buffer *auth_ldap_cafile; unsigned short auth_ldap_starttls; + unsigned short auth_ldap_allow_empty_pw; unsigned short auth_debug; Index: src/mod_auth.c =================================================================== --- src/mod_auth.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -113,6 +113,7 @@ PATCH(auth_ldap_filter); PATCH(auth_ldap_cafile); PATCH(auth_ldap_starttls); + PATCH(auth_ldap_allow_empty_pw); #ifdef USE_LDAP PATCH(ldap); PATCH(ldap_filter_pre); @@ -160,6 +161,8 @@ PATCH(auth_ldap_cafile); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.starttls"))) { PATCH(auth_ldap_starttls); + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.allow-empty-pw"))) { + PATCH(auth_ldap_allow_empty_pw); } } } @@ -312,6 +315,7 @@ { "auth.backend.ldap.starttls", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, { "auth.backend.ldap.bind-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, { "auth.backend.ldap.bind-pw", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */ + { "auth.backend.ldap.allow-empty-pw", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, { "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, { "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, { "auth.debug", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 13 */ @@ -359,11 +363,12 @@ cv[6].destination = s->auth_ldap_filter; cv[7].destination = s->auth_ldap_cafile; cv[8].destination = &(s->auth_ldap_starttls); - cv[9].destination = s->auth_ldap_binddn; - cv[10].destination = s->auth_ldap_bindpw; - cv[11].destination = s->auth_htdigest_userfile; - cv[12].destination = s->auth_htpasswd_userfile; - cv[13].destination = &(s->auth_debug); + cv[9].destination = s->auth_ldap_binddn; + cv[10].destination = s->auth_ldap_bindpw; + cv[11].destination = &(s->auth_ldap_allow_empty_pw); + cv[12].destination = s->auth_htdigest_userfile; + cv[13].destination = s->auth_htpasswd_userfile; + cv[14].destination = &(s->auth_debug); p->config_storage[i] = s; ca = ((data_config *)srv->config_context->data[i])->value; Index: src/mod_fastcgi.c =================================================================== --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -275,6 +275,7 @@ buffer *key; /* like .php */ int note_is_sent; + int last_used_ndx; fcgi_extension_host **hosts; @@ -563,6 +564,7 @@ fe = calloc(1, sizeof(*fe)); assert(fe); fe->key = buffer_init(); + fe->last_used_ndx = -1; buffer_copy_string_buffer(fe->key, key); /* */ @@ -2365,6 +2367,7 @@ * check how much we have to read */ if (ioctl(hctx->fd, FIONREAD, &toread)) { + if( errno == EAGAIN ) return 0; log_error_write(srv, __FILE__, __LINE__, "sd", "unexpected end-of-file (perhaps the fastcgi process died):", fcgi_fd); @@ -2375,12 +2378,23 @@ if (toread > 0) { buffer *b; + chunk *cq_first = hctx->rb->first; + chunk *cq_last = hctx->rb->last; b = chunkqueue_get_append_buffer(hctx->rb); buffer_prepare_copy(b, toread + 1); /* append to read-buffer */ if (-1 == (r = read(hctx->fd, b->ptr, toread))) { + if( errno == EAGAIN ) { + /* roll back the last chunk allocation, + and continue on next iteration */ + buffer_free(hctx->rb->last->mem); + free(hctx->rb->last); + hctx->rb->first = cq_first; + hctx->rb->last = cq_last; + return 0; + } log_error_write(srv, __FILE__, __LINE__, "sds", "unexpected end-of-file (perhaps the fastcgi process died):", fcgi_fd, strerror(errno)); @@ -2393,6 +2407,7 @@ b->used = r + 1; /* one extra for the fake \0 */ b->ptr[b->used - 1] = '\0'; } else { + if( errno == EAGAIN ) return 0; log_error_write(srv, __FILE__, __LINE__, "ssdsb", "unexpected end-of-file (perhaps the fastcgi process died):", "pid:", proc->pid, @@ -2499,6 +2514,8 @@ } break; case FCGI_STDERR: + if (packet.len == 0) break; + log_error_write(srv, __FILE__, __LINE__, "sb", "FastCGI-stderr:", packet.b); @@ -2979,17 +2996,23 @@ size_t k; int ndx, used = -1; - /* get best server */ - for (k = 0, ndx = -1; k < hctx->ext->used; k++) { - host = hctx->ext->hosts[k]; + /* check if the next server has no load. */ + ndx = hctx->ext->last_used_ndx + 1; + if(ndx >= hctx->ext->used || ndx < 0) ndx = 0; + host = hctx->ext->hosts[ndx]; + if (host->load > 0) { + /* get backend with the least load. */ + for (k = 0, ndx = -1; k < hctx->ext->used; k++) { + host = hctx->ext->hosts[k]; - /* we should have at least one proc that can do something */ - if (host->active_procs == 0) continue; + /* we should have at least one proc that can do something */ + if (host->active_procs == 0) continue; - if (used == -1 || host->load < used) { - used = host->load; + if (used == -1 || host->load < used) { + used = host->load; - ndx = k; + ndx = k; + } } } @@ -3005,6 +3028,7 @@ return HANDLER_FINISHED; } + hctx->ext->last_used_ndx = ndx; host = hctx->ext->hosts[ndx]; /* Index: src/server.c =================================================================== --- src/server.c (.../tags/lighttpd-1.4.13) (revision 1664) +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 1664) @@ -163,6 +163,7 @@ #undef CLEAN for (i = 0; i < FILE_CACHE_MAX; i++) { + srv->mtime_cache[i].mtime = (time_t)-1; srv->mtime_cache[i].str = buffer_init(); } @@ -1231,6 +1232,19 @@ srv_socket->fd = -1; /* network_close() will cleanup after us */ + + if (srv->srvconf.pid_file->used && + srv->srvconf.changeroot->used == 0) { + if (0 != unlink(srv->srvconf.pid_file->ptr)) { + if (errno != EACCES && errno != EPERM) { + log_error_write(srv, __FILE__, __LINE__, "sbds", + "unlink failed for:", + srv->srvconf.pid_file, + errno, + strerror(errno)); + } + } + } } } @@ -1335,7 +1349,8 @@ } if (srv->srvconf.pid_file->used && - srv->srvconf.changeroot->used == 0) { + srv->srvconf.changeroot->used == 0 && + 0 == graceful_shutdown) { if (0 != unlink(srv->srvconf.pid_file->ptr)) { if (errno != EACCES && errno != EPERM) { log_error_write(srv, __FILE__, __LINE__, "sbds", Property changes on: . ___________________________________________________________________ Name: svk:merge + a98e19e4-a712-0410-8832-6551a15ffc53:/local/branches/lighttpd-1.4.x:1557