2 ===================================================================
3 --- src/base.h (.../tags/lighttpd-1.4.13) (revision 1664)
4 +++ src/base.h (.../branches/lighttpd-1.4.x) (revision 1664)
6 enum { STAT_CACHE_ENGINE_UNSET,
7 STAT_CACHE_ENGINE_NONE,
8 STAT_CACHE_ENGINE_SIMPLE,
13 unsigned short enable_cores;
15 Index: src/connections.c
16 ===================================================================
17 --- src/connections.c (.../tags/lighttpd-1.4.13) (revision 1664)
18 +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1664)
28 Index: src/configfile.c
29 ===================================================================
30 --- src/configfile.c (.../tags/lighttpd-1.4.13) (revision 1664)
31 +++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 1664)
33 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
34 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("simple"))) {
35 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE;
37 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("fam"))) {
38 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_FAM;
40 } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("disable"))) {
41 srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_NONE;
43 log_error_write(srv, __FILE__, __LINE__, "sb",
44 - "server.stat-cache-engine can be one of \"disable\", \"simple\", \"fam\", but not:", stat_cache_string);
45 + "server.stat-cache-engine can be one of \"disable\", \"simple\","
49 + " but not:", stat_cache_string);
54 ===================================================================
55 --- src/mod_scgi.c (.../tags/lighttpd-1.4.13) (revision 1664)
56 +++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 1664)
58 hctx->reconnects < 5) {
59 scgi_reconnect(srv, hctx);
61 - log_error_write(srv, __FILE__, __LINE__, "sdsdsd",
62 + log_error_write(srv, __FILE__, __LINE__, "ssdsd",
63 "response not sent, request not sent, reconnection.",
64 "connection-fd:", con->fd,
65 "fcgi-fd:", hctx->fd);
67 ===================================================================
68 --- src/request.c (.../tags/lighttpd-1.4.13) (revision 1664)
69 +++ src/request.c (.../branches/lighttpd-1.4.x) (revision 1664)
72 if (host_len == 0) return -1;
74 + /* if the hostname ends in a "." strip it */
75 + if (host->ptr[host_len-1] == '.') host_len -= 1;
77 /* scan from the right and skip the \0 */
78 for (i = host_len - 1; i + 1 > 0; i--) {
79 const char c = host->ptr[i];
80 Index: src/network_backends.h
81 ===================================================================
82 --- src/network_backends.h (.../tags/lighttpd-1.4.13) (revision 1664)
83 +++ src/network_backends.h (.../branches/lighttpd-1.4.x) (revision 1664)
88 -#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && defined(__FreeBSD__)
89 +#if defined HAVE_SYS_UIO_H && defined HAVE_SENDFILE && defined HAVE_WRITEV && (defined(__FreeBSD__) || defined(__DragonFly__))
90 # define USE_FREEBSD_SENDFILE
93 Index: src/mod_proxy.c
94 ===================================================================
95 --- src/mod_proxy.c (.../tags/lighttpd-1.4.13) (revision 1664)
96 +++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 1664)
100 if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) {
101 + if (errno == EAGAIN) return 0;
102 log_error_write(srv, __FILE__, __LINE__, "sds",
103 "unexpected end-of-file (perhaps the proxy process died):",
104 proxy_fd, strerror(errno));
105 Index: src/mod_expire.c
106 ===================================================================
107 --- src/mod_expire.c (.../tags/lighttpd-1.4.13) (revision 1664)
108 +++ src/mod_expire.c (.../branches/lighttpd-1.4.x) (revision 1664)
113 - * '(access|modification) [plus] {<num> <type>}*'
114 + * '(access|now|modification) [plus] {<num> <type>}*'
116 * e.g. 'access 1 years'
119 if (0 == strncmp(ts, "access ", 7)) {
122 + } else if (0 == strncmp(ts, "now ", 4)) {
125 } else if (0 == strncmp(ts, "modification ", 13)) {
132 - /* the rest is just <number> (years|months|days|hours|minutes|seconds) */
133 + /* the rest is just <number> (years|months|weeks|days|hours|minutes|seconds) */
138 } else if (slen == 6 &&
139 0 == strncmp(ts, "months", slen)) {
140 num *= 60 * 60 * 24 * 30;
141 + } else if (slen == 5 &&
142 + 0 == strncmp(ts, "weeks", slen)) {
143 + num *= 60 * 60 * 24 * 7;
144 } else if (slen == 4 &&
145 0 == strncmp(ts, "days", slen)) {
148 num *= 60 * 60 * 24 * 30 * 12;
149 } else if (0 == strcmp(ts, "months")) {
150 num *= 60 * 60 * 24 * 30;
151 + } else if (0 == strcmp(ts, "weeks")) {
152 + num *= 60 * 60 * 24 * 7;
153 } else if (0 == strcmp(ts, "days")) {
155 } else if (0 == strcmp(ts, "hours")) {
156 Index: src/network_freebsd_sendfile.c
157 ===================================================================
158 --- src/network_freebsd_sendfile.c (.../tags/lighttpd-1.4.13) (revision 1664)
159 +++ src/network_freebsd_sendfile.c (.../branches/lighttpd-1.4.x) (revision 1664)
165 +# if defined(__FreeBSD__) || defined(__DragonFly__)
166 /* FreeBSD 4.7, 4.9 defined it in sys/uio.h only if _KERNEL is specified */
167 # define UIO_MAXIOV 1024
169 Index: src/http_auth.c
170 ===================================================================
171 --- src/http_auth.c (.../tags/lighttpd-1.4.13) (revision 1664)
172 +++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 1664)
177 + if (p->conf.auth_ldap_allow_empty_pw != 1 && pw[0] == '\0')
182 buffer_copy_string_buffer(p->ldap_filter, p->conf.ldap_filter_pre);
183 buffer_append_string_buffer(p->ldap_filter, username);
184 Index: src/http_auth.h
185 ===================================================================
186 --- src/http_auth.h (.../tags/lighttpd-1.4.13) (revision 1664)
187 +++ src/http_auth.h (.../branches/lighttpd-1.4.x) (revision 1664)
189 buffer *auth_ldap_filter;
190 buffer *auth_ldap_cafile;
191 unsigned short auth_ldap_starttls;
192 + unsigned short auth_ldap_allow_empty_pw;
194 unsigned short auth_debug;
196 Index: src/mod_auth.c
197 ===================================================================
198 --- src/mod_auth.c (.../tags/lighttpd-1.4.13) (revision 1664)
199 +++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 1664)
201 PATCH(auth_ldap_filter);
202 PATCH(auth_ldap_cafile);
203 PATCH(auth_ldap_starttls);
204 + PATCH(auth_ldap_allow_empty_pw);
207 PATCH(ldap_filter_pre);
209 PATCH(auth_ldap_cafile);
210 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.starttls"))) {
211 PATCH(auth_ldap_starttls);
212 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.allow-empty-pw"))) {
213 + PATCH(auth_ldap_allow_empty_pw);
218 { "auth.backend.ldap.starttls", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
219 { "auth.backend.ldap.bind-dn", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
220 { "auth.backend.ldap.bind-pw", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
221 + { "auth.backend.ldap.allow-empty-pw", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
222 { "auth.backend.htdigest.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
223 { "auth.backend.htpasswd.userfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
224 { "auth.debug", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
225 @@ -359,11 +363,12 @@
226 cv[6].destination = s->auth_ldap_filter;
227 cv[7].destination = s->auth_ldap_cafile;
228 cv[8].destination = &(s->auth_ldap_starttls);
229 - cv[9].destination = s->auth_ldap_binddn;
230 - cv[10].destination = s->auth_ldap_bindpw;
231 - cv[11].destination = s->auth_htdigest_userfile;
232 - cv[12].destination = s->auth_htpasswd_userfile;
233 - cv[13].destination = &(s->auth_debug);
234 + cv[9].destination = s->auth_ldap_binddn;
235 + cv[10].destination = s->auth_ldap_bindpw;
236 + cv[11].destination = &(s->auth_ldap_allow_empty_pw);
237 + cv[12].destination = s->auth_htdigest_userfile;
238 + cv[13].destination = s->auth_htpasswd_userfile;
239 + cv[14].destination = &(s->auth_debug);
241 p->config_storage[i] = s;
242 ca = ((data_config *)srv->config_context->data[i])->value;
243 Index: src/mod_fastcgi.c
244 ===================================================================
245 --- src/mod_fastcgi.c (.../tags/lighttpd-1.4.13) (revision 1664)
246 +++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 1664)
248 buffer *key; /* like .php */
253 fcgi_extension_host **hosts;
256 fe = calloc(1, sizeof(*fe));
258 fe->key = buffer_init();
259 + fe->last_used_ndx = -1;
260 buffer_copy_string_buffer(fe->key, key);
263 @@ -2365,6 +2367,7 @@
264 * check how much we have to read
266 if (ioctl(hctx->fd, FIONREAD, &toread)) {
267 + if( errno == EAGAIN ) return 0;
268 log_error_write(srv, __FILE__, __LINE__, "sd",
269 "unexpected end-of-file (perhaps the fastcgi process died):",
271 @@ -2375,12 +2378,23 @@
275 + chunk *cq_first = hctx->rb->first;
276 + chunk *cq_last = hctx->rb->last;
278 b = chunkqueue_get_append_buffer(hctx->rb);
279 buffer_prepare_copy(b, toread + 1);
281 /* append to read-buffer */
282 if (-1 == (r = read(hctx->fd, b->ptr, toread))) {
283 + if( errno == EAGAIN ) {
284 + /* roll back the last chunk allocation,
285 + and continue on next iteration */
286 + buffer_free(hctx->rb->last->mem);
287 + free(hctx->rb->last);
288 + hctx->rb->first = cq_first;
289 + hctx->rb->last = cq_last;
292 log_error_write(srv, __FILE__, __LINE__, "sds",
293 "unexpected end-of-file (perhaps the fastcgi process died):",
294 fcgi_fd, strerror(errno));
295 @@ -2393,6 +2407,7 @@
296 b->used = r + 1; /* one extra for the fake \0 */
297 b->ptr[b->used - 1] = '\0';
299 + if( errno == EAGAIN ) return 0;
300 log_error_write(srv, __FILE__, __LINE__, "ssdsb",
301 "unexpected end-of-file (perhaps the fastcgi process died):",
303 @@ -2499,6 +2514,8 @@
307 + if (packet.len == 0) break;
309 log_error_write(srv, __FILE__, __LINE__, "sb",
310 "FastCGI-stderr:", packet.b);
312 @@ -2979,17 +2996,23 @@
316 - /* get best server */
317 - for (k = 0, ndx = -1; k < hctx->ext->used; k++) {
318 - host = hctx->ext->hosts[k];
319 + /* check if the next server has no load. */
320 + ndx = hctx->ext->last_used_ndx + 1;
321 + if(ndx >= hctx->ext->used || ndx < 0) ndx = 0;
322 + host = hctx->ext->hosts[ndx];
323 + if (host->load > 0) {
324 + /* get backend with the least load. */
325 + for (k = 0, ndx = -1; k < hctx->ext->used; k++) {
326 + host = hctx->ext->hosts[k];
328 - /* we should have at least one proc that can do something */
329 - if (host->active_procs == 0) continue;
330 + /* we should have at least one proc that can do something */
331 + if (host->active_procs == 0) continue;
333 - if (used == -1 || host->load < used) {
335 + if (used == -1 || host->load < used) {
344 @@ -3005,6 +3028,7 @@
345 return HANDLER_FINISHED;
348 + hctx->ext->last_used_ndx = ndx;
349 host = hctx->ext->hosts[ndx];
353 ===================================================================
354 --- src/server.c (.../tags/lighttpd-1.4.13) (revision 1664)
355 +++ src/server.c (.../branches/lighttpd-1.4.x) (revision 1664)
359 for (i = 0; i < FILE_CACHE_MAX; i++) {
360 + srv->mtime_cache[i].mtime = (time_t)-1;
361 srv->mtime_cache[i].str = buffer_init();
364 @@ -1231,6 +1232,19 @@
367 /* network_close() will cleanup after us */
369 + if (srv->srvconf.pid_file->used &&
370 + srv->srvconf.changeroot->used == 0) {
371 + if (0 != unlink(srv->srvconf.pid_file->ptr)) {
372 + if (errno != EACCES && errno != EPERM) {
373 + log_error_write(srv, __FILE__, __LINE__, "sbds",
374 + "unlink failed for:",
375 + srv->srvconf.pid_file,
384 @@ -1335,7 +1349,8 @@
387 if (srv->srvconf.pid_file->used &&
388 - srv->srvconf.changeroot->used == 0) {
389 + srv->srvconf.changeroot->used == 0 &&
390 + 0 == graceful_shutdown) {
391 if (0 != unlink(srv->srvconf.pid_file->ptr)) {
392 if (errno != EACCES && errno != EPERM) {
393 log_error_write(srv, __FILE__, __LINE__, "sbds",
395 Property changes on: .
396 ___________________________________________________________________
398 + a98e19e4-a712-0410-8832-6551a15ffc53:/local/branches/lighttpd-1.4.x:1557