]> git.pld-linux.org Git - packages/lighttpd.git/blame - lighttpd-branch.diff
- update to r2389:
[packages/lighttpd.git] / lighttpd-branch.diff
CommitLineData
170f212a
ER
1Index: cmake/LighttpdMacros.cmake
2===================================================================
3--- cmake/LighttpdMacros.cmake (.../tags/lighttpd-1.4.20) (revision 0)
738baab9 4+++ cmake/LighttpdMacros.cmake (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
5@@ -0,0 +1,43 @@
6+## our modules are without the "lib" prefix
7+
8+MACRO(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
9+ IF(BUILD_STATIC)
10+ ADD_LIBRARY(${LIBNAME} STATIC ${SRCFILES})
11+ TARGET_LINK_LIBRARIES(lighttpd ${LIBNAME})
12+ ELSE(BUILD_STATIC)
13+ ADD_LIBRARY(${LIBNAME} SHARED ${SRCFILES})
14+ SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
15+ ## Windows likes to link it this way back to app!
16+ IF(WIN32)
17+ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
18+ ENDIF(WIN32)
19+
20+ IF(APPLE)
21+ SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
22+ ENDIF(APPLE)
23+ ENDIF(BUILD_STATIC)
24+ENDMACRO(ADD_AND_INSTALL_LIBRARY)
25+
26+MACRO(LEMON_PARSER SRCFILE)
27+ GET_FILENAME_COMPONENT(SRCBASE ${SRCFILE} NAME_WE)
28+ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h
29+ COMMAND ${CMAKE_BINARY_DIR}/build/lemon
30+ ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
31+ DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
32+ COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}"
33+)
34+ENDMACRO(LEMON_PARSER)
35+
36+MACRO(ADD_TARGET_PROPERTIES _target _name)
37+ SET(_properties)
38+ FOREACH(_prop ${ARGN})
39+ SET(_properties "${_properties} ${_prop}")
40+ ENDFOREACH(_prop)
41+ GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
42+ MESSAGE("adding property to ${_target} ${_name}:" ${_properties})
43+ IF(NOT _old_properties)
44+ # in case it's NOTFOUND
45+ SET(_old_properties)
46+ ENDIF(NOT _old_properties)
47+ SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
48+ENDMACRO(ADD_TARGET_PROPERTIES)
709c1a0b 49Index: configure.in
54b68997 50===================================================================
709c1a0b 51Index: src/configfile-glue.c
54b68997 52===================================================================
738baab9
ER
53--- src/configfile-glue.c (.../tags/lighttpd-1.4.20) (revision 2389)
54+++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
55@@ -1,4 +1,5 @@
56 #include <string.h>
57+#include <stdlib.h>
58
59 #include "base.h"
60 #include "buffer.h"
61@@ -90,6 +91,22 @@
62 case TYPE_STRING: {
63 data_string *ds = (data_string *)du;
64
65+ /* If the value came from an environment variable, then it is a
66+ * data_string, although it may contain a number in ASCII
67+ * decimal format. We try to interpret the string as a decimal
68+ * short before giving up, in order to support setting numeric
69+ * values with environment variables (eg, port number).
70+ */
71+ if (ds->value->ptr && *ds->value->ptr) {
72+ char *e;
73+ long l = strtol(ds->value->ptr, &e, 10);
74+ if (e != ds->value->ptr && !*e && l >=0 && l <= 65535) {
75+ *((unsigned short *)(cv[i].destination)) = l;
76+ break;
77+
78+ }
79+ }
80+
81 log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected a short:", cv[i].key, ds->value);
54b68997 82
709c1a0b
ER
83 return -1;
84Index: src/mod_cgi.c
54b68997 85===================================================================
738baab9
ER
86--- src/mod_cgi.c (.../tags/lighttpd-1.4.20) (revision 2389)
87+++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
88@@ -822,15 +822,27 @@
89 );
90 cgi_env_add(&env, CONST_STR_LEN("SERVER_PORT"), buf, strlen(buf));
91
92+ switch (srv_sock->addr.plain.sa_family) {
93 #ifdef HAVE_IPV6
94- s = inet_ntop(srv_sock->addr.plain.sa_family,
95- srv_sock->addr.plain.sa_family == AF_INET6 ?
96- (const void *) &(srv_sock->addr.ipv6.sin6_addr) :
97- (const void *) &(srv_sock->addr.ipv4.sin_addr),
98- b2, sizeof(b2)-1);
99+ case AF_INET6:
100+ s = inet_ntop(srv_sock->addr.plain.sa_family,
101+ (const void *) &(srv_sock->addr.ipv6.sin6_addr),
102+ b2, sizeof(b2)-1);
103+ break;
104+ case AF_INET:
105+ s = inet_ntop(srv_sock->addr.plain.sa_family,
106+ (const void *) &(srv_sock->addr.ipv4.sin_addr),
107+ b2, sizeof(b2)-1);
108+ break;
109 #else
110- s = inet_ntoa(srv_sock->addr.ipv4.sin_addr);
111+ case AF_INET:
112+ s = inet_ntoa(srv_sock->addr.ipv4.sin_addr);
113+ break;
114 #endif
115+ default:
116+ s = "";
117+ break;
118+ }
119 cgi_env_add(&env, CONST_STR_LEN("SERVER_ADDR"), s, strlen(s));
54b68997 120
709c1a0b
ER
121 s = get_http_method_name(con->request.http_method);
122@@ -848,15 +860,27 @@
123 }
54b68997
ER
124
125
709c1a0b
ER
126+ switch (con->dst_addr.plain.sa_family) {
127 #ifdef HAVE_IPV6
128- s = inet_ntop(con->dst_addr.plain.sa_family,
129- con->dst_addr.plain.sa_family == AF_INET6 ?
130- (const void *) &(con->dst_addr.ipv6.sin6_addr) :
131- (const void *) &(con->dst_addr.ipv4.sin_addr),
132- b2, sizeof(b2)-1);
133+ case AF_INET6:
134+ s = inet_ntop(con->dst_addr.plain.sa_family,
135+ (const void *) &(con->dst_addr.ipv6.sin6_addr),
136+ b2, sizeof(b2)-1);
137+ break;
138+ case AF_INET:
139+ s = inet_ntop(con->dst_addr.plain.sa_family,
140+ (const void *) &(con->dst_addr.ipv4.sin_addr),
141+ b2, sizeof(b2)-1);
142+ break;
143 #else
144- s = inet_ntoa(con->dst_addr.ipv4.sin_addr);
145+ case AF_INET:
146+ s = inet_ntoa(con->dst_addr.ipv4.sin_addr);
147+ break;
148 #endif
149+ default:
150+ s = "";
151+ break;
54b68997 152+ }
709c1a0b 153 cgi_env_add(&env, CONST_STR_LEN("REMOTE_ADDR"), s, strlen(s));
54b68997 154
709c1a0b 155 LI_ltostr(buf,
738baab9
ER
156Index: src/base.h
157===================================================================
158--- src/base.h (.../tags/lighttpd-1.4.20) (revision 2389)
159+++ src/base.h (.../branches/lighttpd-1.4.x) (revision 2389)
160@@ -497,6 +497,7 @@
161 #endif
162 } stat_cache_engine;
163 unsigned short enable_cores;
164+ unsigned short reject_expect_100_with_417;
165 } server_config;
166
167 typedef struct {
170f212a
ER
168Index: src/mod_rewrite.c
169===================================================================
738baab9
ER
170--- src/mod_rewrite.c (.../tags/lighttpd-1.4.20) (revision 2389)
171+++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
172@@ -350,11 +350,7 @@
173
174 if (!p->conf.rewrite) return HANDLER_GO_ON;
175
176- buffer_copy_string_buffer(p->match_buf, con->uri.path);
177- if (con->uri.query->used > 0) {
178- buffer_append_string_len(p->match_buf, CONST_STR_LEN("?"));
179- buffer_append_string_buffer(p->match_buf, con->uri.query);
180- }
181+ buffer_copy_string_buffer(p->match_buf, con->request.uri);
182
183 for (i = 0; i < p->conf.rewrite->used; i++) {
184 pcre *match;
709c1a0b
ER
185Index: src/connections.c
186===================================================================
738baab9
ER
187--- src/connections.c (.../tags/lighttpd-1.4.20) (revision 2389)
188+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
189@@ -330,15 +330,13 @@
190 buffer_prepare_copy(b, 4 * 1024);
191 len = recv(con->fd, b->ptr, b->size - 1, 0);
192 #else
193- if (ioctl(con->fd, FIONREAD, &toread)) {
194- log_error_write(srv, __FILE__, __LINE__, "sd",
195- "unexpected end-of-file:",
196- con->fd);
197- return -1;
198+ if (ioctl(con->fd, FIONREAD, &toread) || toread == 0) {
199+ b = chunkqueue_get_append_buffer(con->read_queue);
200+ buffer_prepare_copy(b, 4 * 1024);
54b68997 201+ } else {
709c1a0b
ER
202+ b = chunkqueue_get_append_buffer(con->read_queue);
203+ buffer_prepare_copy(b, toread + 1);
54b68997 204 }
709c1a0b
ER
205- b = chunkqueue_get_append_buffer(con->read_queue);
206- buffer_prepare_copy(b, toread + 1);
207-
208 len = read(con->fd, b->ptr, b->size - 1);
209 #endif
54b68997 210
170f212a
ER
211@@ -1066,6 +1064,9 @@
212 if (dst_c->file.fd == -1) {
213 /* this should not happen as we cache the fd, but you never know */
214 dst_c->file.fd = open(dst_c->file.name->ptr, O_WRONLY | O_APPEND);
215+#ifdef FD_CLOEXEC
216+ fcntl(dst_c->file.fd, F_SETFD, FD_CLOEXEC);
217+#endif
218 }
219 } else {
220 /* the chunk is too large now, close it */
221Index: src/mod_alias.c
222===================================================================
738baab9
ER
223--- src/mod_alias.c (.../tags/lighttpd-1.4.20) (revision 2389)
224+++ src/mod_alias.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
225@@ -103,9 +103,8 @@
226 }
227 /* ok, they have same prefix. check position */
228 if (a->sorted[j] < a->sorted[k]) {
229- fprintf(stderr, "url.alias: `%s' will never match as `%s' matched first\n",
230- key->ptr,
231- prefix->ptr);
232+ log_error_write(srv, __FILE__, __LINE__, "SBSBS",
233+ "url.alias: `", key, "' will never match as `", prefix, "' matched first");
234 return HANDLER_ERROR;
235 }
236 }
709c1a0b
ER
237Index: src/configfile.c
238===================================================================
738baab9
ER
239--- src/configfile.c (.../tags/lighttpd-1.4.20) (revision 2389)
240+++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 2389)
241@@ -94,6 +94,7 @@
242 { "etag.use-inode", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 49 */
243 { "etag.use-mtime", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 50 */
244 { "etag.use-size", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 51 */
245+ { "server.reject-expect-100-with-417", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 52 */
246 { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
247 { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
248 { "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
249@@ -135,6 +136,7 @@
250
251 cv[43].destination = &(srv->srvconf.max_conns);
252 cv[12].destination = &(srv->srvconf.max_request_size);
253+ cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
254 srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
255
256 assert(srv->config_storage);
257@@ -159,7 +161,7 @@
258 s->max_write_idle = 360;
259 s->use_xattr = 0;
260 s->is_ssl = 0;
261- s->ssl_use_sslv2 = 1;
262+ s->ssl_use_sslv2 = 0;
263 s->use_ipv6 = 0;
264 #ifdef HAVE_LSTAT
265 s->follow_symlink = 1;
266@@ -940,7 +942,6 @@
54b68997
ER
267 }
268
709c1a0b
ER
269 int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
270- proc_handler_t proc;
271 tokenizer_t t;
272 int ret;
273 buffer *source;
738baab9 274@@ -960,7 +961,7 @@
709c1a0b
ER
275 chdir(context->basedir->ptr);
276 }
54b68997 277
709c1a0b
ER
278- if (0 != proc_open_buffer(&proc, cmd, NULL, out, NULL)) {
279+ if (0 != proc_open_buffer(cmd, NULL, out, NULL)) {
280 log_error_write(srv, __FILE__, __LINE__, "sbss",
281 "opening", source, "failed:", strerror(errno));
282 ret = -1;
170f212a
ER
283Index: src/mod_trigger_b4_dl.c
284===================================================================
738baab9
ER
285--- src/mod_trigger_b4_dl.c (.../tags/lighttpd-1.4.20) (revision 2389)
286+++ src/mod_trigger_b4_dl.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
287@@ -1,5 +1,6 @@
288 #include <ctype.h>
289 #include <stdlib.h>
290+#include <fcntl.h>
291 #include <string.h>
292
293 #include "base.h"
294@@ -180,6 +181,9 @@
295 "gdbm-open failed");
296 return HANDLER_ERROR;
297 }
298+#ifdef FD_CLOEXEC
299+ fcntl(gdbm_fdesc(s->db), F_SETFD, FD_CLOEXEC);
300+#endif
301 }
302 #endif
303 #if defined(HAVE_PCRE_H)
304Index: src/mod_mysql_vhost.c
305===================================================================
738baab9
ER
306--- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.20) (revision 2389)
307+++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
308@@ -245,7 +245,6 @@
309 if (!(buffer_is_empty(s->myuser) ||
310 buffer_is_empty(s->mydb))) {
311 my_bool reconnect = 1;
312- int fd;
313
314 if (NULL == (s->mysql = mysql_init(NULL))) {
315 log_error_write(srv, __FILE__, __LINE__, "s", "mysql_init() failed, exiting...");
316@@ -267,19 +266,27 @@
317 return HANDLER_ERROR;
318 }
319 #undef FOO
320+
321+#if 0
322 /* set close_on_exec for mysql the hard way */
323 /* Note: this only works as it is done during startup, */
324 /* otherwise we cannot be sure that mysql is fd i-1 */
325- if (-1 == (fd = open("/dev/null", 0))) {
326+ { int fd;
327+ if (-1 != (fd = open("/dev/null", 0))) {
328 close(fd);
329+#ifdef FD_CLOEXEC
330 fcntl(fd-1, F_SETFD, FD_CLOEXEC);
331- }
332+#endif
333+ } }
334+#else
335+#ifdef FD_CLOEXEC
336+ fcntl(s->mysql->net.fd, F_SETFD, FD_CLOEXEC);
337+#endif
338+#endif
339 }
340 }
341
342-
343-
344- return HANDLER_GO_ON;
345+ return HANDLER_GO_ON;
346 }
347
348 #define PATCH(x) \
738baab9
ER
349Index: src/request.c
350===================================================================
351--- src/request.c (.../tags/lighttpd-1.4.20) (revision 2389)
352+++ src/request.c (.../branches/lighttpd-1.4.x) (revision 2389)
353@@ -894,11 +894,12 @@
354 *
355 */
356
357- con->http_status = 417;
358- con->keep_alive = 0;
359-
360- array_insert_unique(con->request.headers, (data_unset *)ds);
361- return 0;
362+ if (srv->srvconf.reject_expect_100_with_417 && 0 == buffer_caseless_compare(CONST_BUF_LEN(ds->value), CONST_STR_LEN("100-continue"))) {
363+ con->http_status = 417;
364+ con->keep_alive = 0;
365+ array_insert_unique(con->request.headers, (data_unset *)ds);
366+ return 0;
367+ }
368 } else if (cmp > 0 && 0 == (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), CONST_STR_LEN("Host")))) {
369 if (!con->request.http_host) {
370 con->request.http_host = ds->value;
170f212a
ER
371Index: src/inet_ntop_cache.c
372===================================================================
738baab9
ER
373--- src/inet_ntop_cache.c (.../tags/lighttpd-1.4.20) (revision 2389)
374+++ src/inet_ntop_cache.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
375@@ -11,7 +11,7 @@
376 #ifdef HAVE_IPV6
377 size_t ndx = 0, i;
378 for (i = 0; i < INET_NTOP_CACHE_MAX; i++) {
379- if (srv->inet_ntop_cache[i].ts != 0) {
380+ if (srv->inet_ntop_cache[i].ts != 0 && srv->inet_ntop_cache[i].family == addr->plain.sa_family) {
381 if (srv->inet_ntop_cache[i].family == AF_INET6 &&
382 0 == memcmp(srv->inet_ntop_cache[i].addr.ipv6.s6_addr, addr->ipv6.sin6_addr.s6_addr, 16)) {
383 /* IPv6 found in cache */
384Index: src/mod_rrdtool.c
385===================================================================
738baab9
ER
386--- src/mod_rrdtool.c (.../tags/lighttpd-1.4.20) (revision 2389)
387+++ src/mod_rrdtool.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
388@@ -179,6 +179,11 @@
389 p->read_fd = from_rrdtool_fds[0];
390 p->rrdtool_pid = pid;
391
392+#ifdef FD_CLOEXEC
393+ fcntl(p->write_fd, F_SETFD, FD_CLOEXEC);
394+ fcntl(p->read_fd, F_SETFD, FD_CLOEXEC);
395+#endif
396+
397 break;
398 }
399 }
2ed0f534
ER
400Index: src/response.c
401===================================================================
738baab9
ER
402--- src/response.c (.../tags/lighttpd-1.4.20) (revision 2389)
403+++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2389)
2ed0f534
ER
404@@ -44,16 +44,15 @@
405 buffer_append_string(b, get_http_status_name(con->http_status));
406
407 if (con->request.http_version != HTTP_VERSION_1_1 || con->keep_alive == 0) {
408- buffer_append_string_len(b, CONST_STR_LEN("\r\nConnection: "));
409 if (con->keep_alive) {
410- buffer_append_string_len(b, CONST_STR_LEN("keep-alive"));
411+ response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("keep-alive"));
412 } else {
413- buffer_append_string_len(b, CONST_STR_LEN("close"));
414+ response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("close"));
415 }
416 }
417
418 if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
419- buffer_append_string_len(b, CONST_STR_LEN("\r\nTransfer-Encoding: chunked"));
420+ response_header_overwrite(srv, con, CONST_STR_LEN("Transfer-Encoding"), CONST_STR_LEN("chunked"));
421 }
422
423
170f212a
ER
424@@ -233,6 +232,27 @@
425 }
426
427
428+ /**
429+ *
430+ * call plugins
431+ *
432+ * - based on the raw URL
433+ *
434+ */
435+
436+ switch(r = plugins_call_handle_uri_raw(srv, con)) {
437+ case HANDLER_GO_ON:
438+ break;
439+ case HANDLER_FINISHED:
440+ case HANDLER_COMEBACK:
441+ case HANDLER_WAIT_FOR_EVENT:
442+ case HANDLER_ERROR:
443+ return r;
444+ default:
445+ log_error_write(srv, __FILE__, __LINE__, "sd", "handle_uri_raw: unknown return value", r);
446+ break;
447+ }
448+
449 /* build filename
450 *
451 * - decode url-encodings (e.g. %20 -> ' ')
452@@ -240,6 +260,7 @@
453 */
454
455
456+
457 if (con->request.http_method == HTTP_METHOD_OPTIONS &&
458 con->uri.path_raw->ptr[0] == '*' && con->uri.path_raw->ptr[1] == '\0') {
459 /* OPTIONS * ... */
460@@ -255,32 +276,10 @@
461 log_error_write(srv, __FILE__, __LINE__, "sb", "URI-path : ", con->uri.path);
462 }
463
464-
465 /**
466 *
467 * call plugins
468 *
469- * - based on the raw URL
470- *
471- */
472-
473- switch(r = plugins_call_handle_uri_raw(srv, con)) {
474- case HANDLER_GO_ON:
475- break;
476- case HANDLER_FINISHED:
477- case HANDLER_COMEBACK:
478- case HANDLER_WAIT_FOR_EVENT:
479- case HANDLER_ERROR:
480- return r;
481- default:
482- log_error_write(srv, __FILE__, __LINE__, "sd", "handle_uri_raw: unknown return value", r);
483- break;
484- }
485-
486- /**
487- *
488- * call plugins
489- *
490 * - based on the clean URL
491 *
492 */
738baab9
ER
493Index: src/buffer.c
494===================================================================
495--- src/buffer.c (.../tags/lighttpd-1.4.20) (revision 2389)
496+++ src/buffer.c (.../branches/lighttpd-1.4.x) (revision 2389)
497@@ -159,7 +159,7 @@
498 if (!src) return -1;
499
500 if (src->used == 0) {
501- b->used = 0;
502+ buffer_reset(b);
503 return 0;
504 }
505 return buffer_copy_string_len(b, src->ptr, src->used - 1);
506@@ -187,6 +187,7 @@
507 if (!s || !b) return -1;
508
509 s_len = strlen(s);
510+ if (s_len > maxlen) s_len = maxlen;
511 buffer_prepare_append(b, maxlen + 1);
512 if (b->used == 0)
513 b->used++;
709c1a0b
ER
514Index: src/mod_simple_vhost.c
515===================================================================
738baab9
ER
516--- src/mod_simple_vhost.c (.../tags/lighttpd-1.4.20) (revision 2389)
517+++ src/mod_simple_vhost.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
518@@ -249,6 +249,8 @@
519 return HANDLER_GO_ON;
520 } else {
521 buffer_copy_string_buffer(con->server_name, p->conf.default_host);
522+ /* do not cache default host */
523+ return HANDLER_GO_ON;
524 }
525 } else {
526 buffer_copy_string_buffer(con->server_name, con->uri.authority);
2ed0f534
ER
527Index: src/mod_proxy.c
528===================================================================
738baab9
ER
529--- src/mod_proxy.c (.../tags/lighttpd-1.4.20) (revision 2389)
530+++ src/mod_proxy.c (.../branches/lighttpd-1.4.x) (revision 2389)
531@@ -454,6 +454,7 @@
532
533 if (ds->value->used && ds->key->used) {
534 if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Connection"))) continue;
535+ if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Proxy-Connection"))) continue;
536
537 buffer_append_string_buffer(b, ds->key);
538 buffer_append_string_len(b, CONST_STR_LEN(": "));
539@@ -652,7 +653,7 @@
170f212a
ER
540 buffer_prepare_append(hctx->response, b + 1);
541 hctx->response->used = 1;
542 } else {
543- buffer_prepare_append(hctx->response, hctx->response->used + b);
544+ buffer_prepare_append(hctx->response, b);
545 }
546
547 if (-1 == (r = read(hctx->fd, hctx->response->ptr + hctx->response->used - 1, b))) {
738baab9 548@@ -1198,7 +1199,8 @@
2ed0f534
ER
549 host = (data_proxy *)extension->value->data[0];
550
551 /* Use last_used_ndx from first host in list */
552- k = ndx = host->last_used_ndx;
553+ k = host->last_used_ndx;
554+ ndx = k + 1; /* use next host after the last one */
555 if (ndx < 0) ndx = 0;
556
557 /* Search first active host after last_used_ndx */
170f212a
ER
558Index: src/config.h.cmake
559===================================================================
560--- src/config.h.cmake (.../tags/lighttpd-1.4.20) (revision 0)
738baab9
ER
561+++ src/config.h.cmake (.../branches/lighttpd-1.4.x) (revision 2389)
562@@ -0,0 +1,157 @@
170f212a
ER
563+/*
564+ CMake autogenerated config.h file. Do not edit!
565+*/
566+
738baab9
ER
567+/* Package details */
568+#define LIGHTTPD_VERSION_ID ${LIGHTTPD_VERSION_ID}
569+#define PACKAGE_NAME "${PACKAGE_NAME}"
570+#define PACKAGE_VERSION "${PACKAGE_VERSION}"
571+#define PACKAGE_BUILD_DATE "${PACKAGE_BUILD_DATE}"
572+#define LIBRARY_DIR "${LIGHTTPD_LIBRARY_DIR}"
573+
170f212a
ER
574+/* System */
575+#cmakedefine HAVE_SYS_DEVPOLL_H
576+#cmakedefine HAVE_SYS_EPOLL_H
577+#cmakedefine HAVE_SYS_EVENT_H
578+#cmakedefine HAVE_SYS_MMAN_H
579+#cmakedefine HAVE_SYS_POLL_H
580+#cmakedefine HAVE_SYS_PORT_H
581+#cmakedefine HAVE_SYS_PRCTL_H
582+#cmakedefine HAVE_SYS_RESOURCE_H
583+#cmakedefine HAVE_SYS_SENDFILE_H
584+#cmakedefine HAVE_SYS_SELECT_H
585+#cmakedefine HAVE_SYS_SYSLIMITS_H
586+#cmakedefine HAVE_SYS_TYPES_H
587+#cmakedefine HAVE_SYS_UIO_H
588+#cmakedefine HAVE_SYS_UN_H
589+#cmakedefine HAVE_SYS_WAIT_H
590+#cmakedefine HAVE_SYS_TIME_H
591+#cmakedefine HAVE_UNISTD_H
592+#cmakedefine HAVE_PTHREAD_H
593+#cmakedefine HAVE_INET_ATON
594+#cmakedefine HAVE_IPV6
595+
596+/* XATTR */
597+#cmakedefine HAVE_ATTR_ATTRIBUTES_H
598+#cmakedefine HAVE_XATTR
599+
600+/* mySQL */
601+#cmakedefine HAVE_MYSQL_H
602+#cmakedefine HAVE_MYSQL
603+
604+/* OpenSSL */
605+#cmakedefine HAVE_OPENSSL_SSL_H
606+#cmakedefine HAVE_LIBCRYPTO
607+#cmakedefine OPENSSL_NO_KRB5
608+#cmakedefine HAVE_LIBSSL
609+
610+/* BZip */
611+#cmakedefine HAVE_BZLIB_H
612+#cmakedefine HAVE_LIBBZ2
613+
614+/* FAM */
615+#cmakedefine HAVE_FAM_H
616+#cmakedefine HAVE_FAMNOEXISTS
617+
618+/* getopt */
619+#cmakedefine HAVE_GETOPT_H
620+
621+#cmakedefine HAVE_INTTYPES_H
622+
623+/* LDAP */
624+#cmakedefine HAVE_LDAP_H
625+#cmakedefine HAVE_LIBLDAP
626+#cmakedefine HAVE_LBER_H
627+#cmakedefine HAVE_LIBLBER
628+#cmakedefine LDAP_DEPRECATED 1
629+
630+/* XML */
631+#cmakedefine HAVE_LIBXML_H
632+#cmakedefine HAVE_LIBXML
633+
634+/* PCRE */
635+#cmakedefine HAVE_PCRE_H
636+#cmakedefine HAVE_LIBPCRE
637+
638+#cmakedefine HAVE_POLL_H
639+#cmakedefine HAVE_PWD_H
640+
641+/* sqlite3 */
642+#cmakedefine HAVE_SQLITE3_H
643+#cmakedefine HAVE_LIBPCRE
644+
645+#cmakedefine HAVE_STDDEF_H
646+#cmakedefine HAVE_STDINT_H
647+#cmakedefine HAVE_SYSLOG_H
648+
649+/* UUID */
650+#cmakedefine HAVE_UUID_UUID_H
651+#cmakedefine HAVE_LIBUUID
652+
653+/* ZLIB */
654+#cmakedefine HAVE_ZLIB_H
655+#cmakedefine HAVE_LIBZ
656+
657+/* lua */
658+#cmakedefine HAVE_LUA_H
659+#cmakedefine HAVE_LIBLUA
660+
661+/* gdbm */
662+#cmakedefine HAVE_GDBM_H
663+#cmakedefine HAVE_GDBM
664+
665+/* memcache */
666+#cmakedefine HAVE_MEMCACHE_H
667+
668+/* inotify */
669+#cmakedefine HAVE_INOTIFY_INIT
670+#cmakedefine HAVE_SYS_INOTIFY_H
671+
672+/* Types */
673+#cmakedefine HAVE_SOCKLEN_T
674+#cmakedefine SIZEOF_LONG ${SIZEOF_LONG}
675+#cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T}
676+
677+/* Functions */
678+#cmakedefine HAVE_CHROOT
679+#cmakedefine HAVE_CRYPT
680+#cmakedefine HAVE_EPOLL_CTL
681+#cmakedefine HAVE_FORK
682+#cmakedefine HAVE_GETRLIMIT
683+#cmakedefine HAVE_GETUID
684+#cmakedefine HAVE_GMTIME_R
685+#cmakedefine HAVE_INET_NTOP
686+#cmakedefine HAVE_KQUEUE
687+#cmakedefine HAVE_LOCALTIME_R
688+#cmakedefine HAVE_LSTAT
689+#cmakedefine HAVE_MADVISE
690+#cmakedefine HAVE_MEMCPY
691+#cmakedefine HAVE_MEMSET
692+#cmakedefine HAVE_MMAP
693+#cmakedefine HAVE_PATHCONF
694+#cmakedefine HAVE_POLL
695+#cmakedefine HAVE_PORT_CREATE
696+#cmakedefine HAVE_PRCTL
697+#cmakedefine HAVE_PREAD
698+#cmakedefine HAVE_POSIX_FADVISE
699+#cmakedefine HAVE_SELECT
700+#cmakedefine HAVE_SENDFILE
701+#cmakedefine HAVE_SEND_FILE
702+#cmakedefine HAVE_SENDFILE64
703+#cmakedefine HAVE_SENDFILEV
704+#cmakedefine HAVE_SIGACTION
705+#cmakedefine HAVE_SIGNAL
706+#cmakedefine HAVE_SIGTIMEDWAIT
707+#cmakedefine HAVE_STRPTIME
708+#cmakedefine HAVE_SYSLOG
709+#cmakedefine HAVE_WRITEV
710+
711+/* libcrypt */
712+#cmakedefine HAVE_CRYPT_H
713+#cmakedefine HAVE_LIBCRYPT
714+
715+/* fastcgi */
716+#cmakedefine HAVE_FASTCGI_H
717+#cmakedefine HAVE_FASTCGI_FASTCGI_H
718+
719+#cmakedefine LIGHTTPD_STATIC
738baab9
ER
720Index: src/network_freebsd_sendfile.c
721===================================================================
722--- src/network_freebsd_sendfile.c (.../tags/lighttpd-1.4.20) (revision 2389)
723+++ src/network_freebsd_sendfile.c (.../branches/lighttpd-1.4.x) (revision 2389)
724@@ -167,6 +167,7 @@
725 switch(errno) {
726 case EAGAIN:
727 case EINTR:
728+ r = 0; /* try again later */
729 break;
730 case ENOTCONN:
731 return -2;
732@@ -174,10 +175,7 @@
733 log_error_write(srv, __FILE__, __LINE__, "ssd", "sendfile: ", strerror(errno), errno);
734 return -1;
735 }
736- }
737-
738- if (r == 0 && (errno != EAGAIN && errno != EINTR)) {
739- int oerrno = errno;
740+ } else if (r == 0) {
741 /* We got an event to write but we wrote nothing
742 *
743 * - the file shrinked -> error
744@@ -190,12 +188,9 @@
745
746 if (offset >= sce->st.st_size) {
747 /* file shrinked, close the connection */
748- errno = oerrno;
749-
750 return -1;
751 }
752
753- errno = oerrno;
754 return -2;
755 }
756
709c1a0b
ER
757Index: src/http_auth.c
758===================================================================
738baab9
ER
759--- src/http_auth.c (.../tags/lighttpd-1.4.20) (revision 2389)
760+++ src/http_auth.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
761@@ -57,22 +57,25 @@
762
763 static const char base64_pad = '=';
764
765+/* "A-Z a-z 0-9 + /" maps to 0-63 */
766 static const short base64_reverse_table[256] = {
767- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
768- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
769- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
770- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
771- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
772- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
773- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
774- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
775- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
776- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
777- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
778- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
779- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
780- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
781- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
782+/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
783+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00 - 0x0F */
784+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10 - 0x1F */
785+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /* 0x20 - 0x2F */
786+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, /* 0x30 - 0x3F */
787+ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* 0x40 - 0x4F */
788+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, /* 0x50 - 0x5F */
789+ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 0x60 - 0x6F */
790+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, /* 0x70 - 0x7F */
791+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x80 - 0x8F */
792+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x90 - 0x9F */
793+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xA0 - 0xAF */
794+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xB0 - 0xBF */
795+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xC0 - 0xCF */
796+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xD0 - 0xDF */
797+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xE0 - 0xEF */
798+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xF0 - 0xFF */
799 };
54b68997 800
54b68997 801
709c1a0b
ER
802@@ -697,7 +700,7 @@
803 }
804 } else if (p->conf.auth_backend == AUTH_BACKEND_LDAP) {
805 #ifdef USE_LDAP
806- LDAP *ldap = NULL;
807+ LDAP *ldap;
808 LDAPMessage *lm, *first;
809 char *dn;
810 int ret;
811@@ -742,56 +745,45 @@
812 buffer_append_string_buffer(p->ldap_filter, username);
813 buffer_append_string_buffer(p->ldap_filter, p->conf.ldap_filter_post);
54b68997 814
54b68997 815+
709c1a0b
ER
816 /* 2. */
817- if (p->conf.ldap == NULL ||
818- LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
819- /* try again if ldap was only temporary down */
820- if (p->conf.ldap == NULL || ret != LDAP_SERVER_DOWN || LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
821- if (auth_ldap_init(srv, &p->conf) != HANDLER_GO_ON)
822+ if (p->anon_conf->ldap == NULL ||
823+ LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
824+
825+ /* try again; the ldap library sometimes fails for the first call but reconnects */
826+ if (p->anon_conf->ldap == NULL || ret != LDAP_SERVER_DOWN ||
827+ LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
828+
829+ if (auth_ldap_init(srv, p->anon_conf) != HANDLER_GO_ON)
830 return -1;
831
832- ldap = p->conf.ldap; /* save temporary ldap connection (TODO: redo ldap) */
833- if (LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
834+ if (p->anon_conf->ldap == NULL ||
835+ LDAP_SUCCESS != (ret = ldap_search_s(p->anon_conf->ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) {
836 log_error_write(srv, __FILE__, __LINE__, "sssb",
837 "ldap:", ldap_err2string(ret), "filter:", p->ldap_filter);
838- /* destroy temporary ldap connection (TODO: redo ldap) */
839- ldap_unbind_s(ldap);
840 return -1;
841 }
842 }
843 }
54b68997 844
709c1a0b
ER
845- if (NULL == (first = ldap_first_entry(p->conf.ldap, lm))) {
846- /* No matching entry is not an error */
847- /* log_error_write(srv, __FILE__, __LINE__, "s", "ldap ..."); */
848+ if (NULL == (first = ldap_first_entry(p->anon_conf->ldap, lm))) {
849+ log_error_write(srv, __FILE__, __LINE__, "s", "ldap ...");
54b68997 850
709c1a0b 851 ldap_msgfree(lm);
54b68997 852
709c1a0b
ER
853- /* destroy temporary ldap connection (TODO: redo ldap) */
854- if (NULL != ldap) {
855- ldap_unbind_s(ldap);
856- }
857 return -1;
858 }
54b68997 859
709c1a0b
ER
860- if (NULL == (dn = ldap_get_dn(p->conf.ldap, first))) {
861- log_error_write(srv, __FILE__, __LINE__, "s", "ldap: ldap_get_dn failed");
862+ if (NULL == (dn = ldap_get_dn(p->anon_conf->ldap, first))) {
863+ log_error_write(srv, __FILE__, __LINE__, "s", "ldap ...");
54b68997 864
709c1a0b 865 ldap_msgfree(lm);
54b68997 866
709c1a0b
ER
867- /* destroy temporary ldap connection (TODO: redo ldap) */
868- if (NULL != ldap) {
869- ldap_unbind_s(ldap);
870- }
871 return -1;
872 }
54b68997 873
709c1a0b 874 ldap_msgfree(lm);
54b68997 875
709c1a0b
ER
876- /* destroy temporary ldap connection (TODO: redo ldap) */
877- if (NULL != ldap) {
878- ldap_unbind_s(ldap);
879- }
54b68997 880
709c1a0b
ER
881 /* 3. */
882 if (NULL == (ldap = ldap_init(p->conf.auth_ldap_hostname->ptr, LDAP_PORT))) {
170f212a
ER
883Index: src/mod_redirect.c
884===================================================================
738baab9
ER
885--- src/mod_redirect.c (.../tags/lighttpd-1.4.20) (revision 2389)
886+++ src/mod_redirect.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
887@@ -178,11 +178,7 @@
888
889 mod_redirect_patch_connection(srv, con, p);
890
891- buffer_copy_string_buffer(p->match_buf, con->uri.path);
892- if (con->uri.query->used > 0) {
893- buffer_append_string_len(p->match_buf, CONST_STR_LEN("?"));
894- buffer_append_string_buffer(p->match_buf, con->uri.query);
895- }
896+ buffer_copy_string_buffer(p->match_buf, con->request.uri);
897
898 for (i = 0; i < p->conf.redirect->used; i++) {
899 pcre *match;
709c1a0b
ER
900Index: src/http_auth.h
901===================================================================
738baab9
ER
902--- src/http_auth.h (.../tags/lighttpd-1.4.20) (revision 2389)
903+++ src/http_auth.h (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b 904@@ -63,7 +63,7 @@
54b68997 905
709c1a0b 906 mod_auth_plugin_config **config_storage;
54b68997 907
709c1a0b
ER
908- mod_auth_plugin_config conf; /* this is only used as long as no handler_ctx is setup */
909+ mod_auth_plugin_config conf, *anon_conf; /* this is only used as long as no handler_ctx is setup */
910 } mod_auth_plugin_data;
54b68997 911
709c1a0b 912 int http_auth_basic_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);
170f212a
ER
913Index: src/mod_webdav.c
914===================================================================
738baab9
ER
915--- src/mod_webdav.c (.../tags/lighttpd-1.4.20) (revision 2389)
916+++ src/mod_webdav.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
917@@ -1026,6 +1026,8 @@
918 if (MAP_FAILED == (c->file.mmap.start = mmap(0, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
919 log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
920 strerror(errno), c->file.name, c->file.fd);
921+ close(c->file.fd);
922+ c->file.fd = -1;
923
924 return -1;
925 }
926@@ -1723,6 +1725,8 @@
927 if (MAP_FAILED == (c->file.mmap.start = mmap(0, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
928 log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
929 strerror(errno), c->file.name, c->file.fd);
930+ close(c->file.fd);
931+ c->file.fd = -1;
932
933 return HANDLER_ERROR;
934 }
2ed0f534
ER
935Index: src/mod_compress.c
936===================================================================
738baab9
ER
937--- src/mod_compress.c (.../tags/lighttpd-1.4.20) (revision 2389)
938+++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 2389)
2ed0f534
ER
939@@ -49,6 +49,7 @@
940 buffer *compress_cache_dir;
941 array *compress;
942 off_t compress_max_filesize; /** max filesize in kb */
943+ int allowed_encodings;
944 } plugin_config;
945
946 typedef struct {
947@@ -154,6 +155,7 @@
948 { "compress.cache-dir", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
949 { "compress.filetype", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
950 { "compress.max-filesize", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
951+ { "compress.allowed-encodings", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
952 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
953 };
954
955@@ -161,15 +163,18 @@
956
957 for (i = 0; i < srv->config_context->used; i++) {
958 plugin_config *s;
959+ array *encodings_arr = array_init();
960
961 s = calloc(1, sizeof(plugin_config));
962 s->compress_cache_dir = buffer_init();
963 s->compress = array_init();
964 s->compress_max_filesize = 0;
965+ s->allowed_encodings = 0;
966
967 cv[0].destination = s->compress_cache_dir;
968 cv[1].destination = s->compress;
969 cv[2].destination = &(s->compress_max_filesize);
970+ cv[3].destination = encodings_arr; /* temp array for allowed encodings list */
971
972 p->config_storage[i] = s;
973
974@@ -177,6 +182,39 @@
975 return HANDLER_ERROR;
976 }
977
978+ if (encodings_arr->used) {
979+ size_t j = 0;
980+ for (j = 0; j < encodings_arr->used; j++) {
981+ data_string *ds = (data_string *)encodings_arr->data[j];
982+#ifdef USE_ZLIB
983+ if (NULL != strstr(ds->value->ptr, "gzip"))
984+ s->allowed_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
985+ if (NULL != strstr(ds->value->ptr, "deflate"))
986+ s->allowed_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
987+ /*
988+ if (NULL != strstr(ds->value->ptr, "compress"))
989+ s->allowed_encodings |= HTTP_ACCEPT_ENCODING_COMPRESS;
990+ */
991+#endif
992+#ifdef USE_BZ2LIB
993+ if (NULL != strstr(ds->value->ptr, "bzip2"))
994+ s->allowed_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
995+#endif
996+ }
997+ } else {
998+ /* default encodings */
999+ s->allowed_encodings = 0
1000+#ifdef USE_ZLIB
1001+ | HTTP_ACCEPT_ENCODING_GZIP | HTTP_ACCEPT_ENCODING_DEFLATE
1002+#endif
1003+#ifdef USE_BZ2LIB
1004+ | HTTP_ACCEPT_ENCODING_BZIP2
1005+#endif
1006+ ;
1007+ }
1008+
1009+ array_free(encodings_arr);
1010+
1011 if (!buffer_is_empty(s->compress_cache_dir)) {
1012 struct stat st;
1013 mkdir_recursive(s->compress_cache_dir->ptr);
1014@@ -587,6 +625,7 @@
1015 PATCH(compress_cache_dir);
1016 PATCH(compress);
1017 PATCH(compress_max_filesize);
1018+ PATCH(allowed_encodings);
1019
1020 /* skip the first, the global context */
1021 for (i = 1; i < srv->config_context->used; i++) {
1022@@ -606,6 +645,8 @@
1023 PATCH(compress);
1024 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.max-filesize"))) {
1025 PATCH(compress_max_filesize);
1026+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.allowed-encodings"))) {
1027+ PATCH(allowed_encodings);
1028 }
1029 }
1030 }
738baab9
ER
1031@@ -619,6 +660,7 @@
1032 size_t m;
1033 off_t max_fsize;
1034 stat_cache_entry *sce = NULL;
1035+ buffer *mtime = NULL;
1036
1037 if (con->mode != DIRECT || con->http_status) return HANDLER_GO_ON;
1038
1039@@ -636,8 +678,30 @@
1040
1041 max_fsize = p->conf.compress_max_filesize;
1042
1043- stat_cache_get_entry(srv, con, con->physical.path, &sce);
1044+ if (con->conf.log_request_handling) {
1045+ log_error_write(srv, __FILE__, __LINE__, "s", "-- handling file as static file");
1046+ }
1047
1048+ if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) {
1049+ con->http_status = 403;
1050+
1051+ log_error_write(srv, __FILE__, __LINE__, "sbsb",
1052+ "not a regular file:", con->uri.path,
1053+ "->", con->physical.path);
1054+
1055+ return HANDLER_FINISHED;
1056+ }
1057+
1058+ /* we only handle regular files */
1059+#ifdef HAVE_LSTAT
1060+ if ((sce->is_symlink == 1) && !con->conf.follow_symlink) {
1061+ return HANDLER_GO_ON;
1062+ }
1063+#endif
1064+ if (!S_ISREG(sce->st.st_mode)) {
1065+ return HANDLER_GO_ON;
1066+ }
1067+
1068 /* don't compress files that are too large as we need to much time to handle them */
1069 if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return HANDLER_GO_ON;
1070
1071@@ -668,27 +732,21 @@
2ed0f534
ER
1072 if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Accept-Encoding"))) {
1073 int accept_encoding = 0;
1074 char *value = ds->value->ptr;
1075- int srv_encodings = 0;
1076 int matched_encodings = 0;
1077
1078 /* get client side support encodings */
1079+#ifdef USE_ZLIB
1080 if (NULL != strstr(value, "gzip")) accept_encoding |= HTTP_ACCEPT_ENCODING_GZIP;
1081 if (NULL != strstr(value, "deflate")) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;
1082 if (NULL != strstr(value, "compress")) accept_encoding |= HTTP_ACCEPT_ENCODING_COMPRESS;
1083+#endif
1084+#ifdef USE_BZ2LIB
1085 if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
1086+#endif
1087 if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
1088
1089- /* get server side supported ones */
1090-#ifdef USE_BZ2LIB
1091- srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
1092-#endif
1093-#ifdef USE_ZLIB
1094- srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
1095- srv_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
1096-#endif
1097-
1098 /* find matching entries */
1099- matched_encodings = accept_encoding & srv_encodings;
1100+ matched_encodings = accept_encoding & p->conf.allowed_encodings;
1101
1102 if (matched_encodings) {
1103 const char *dflt_gzip = "gzip";
738baab9
ER
1104@@ -698,6 +756,17 @@
1105 const char *compression_name = NULL;
1106 int compression_type = 0;
1107
1108+ mtime = strftime_cache_get(srv, sce->st.st_mtime);
1109+
1110+ /* try matching original etag of uncompressed version */
1111+ etag_mutate(con->physical.etag, sce->etag);
1112+ if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
1113+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
1114+ response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
1115+ response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
1116+ return HANDLER_FINISHED;
1117+ }
1118+
1119 /* select best matching encoding */
1120 if (matched_encodings & HTTP_ACCEPT_ENCODING_BZIP2) {
1121 compression_type = HTTP_ACCEPT_ENCODING_BZIP2;
1122@@ -710,41 +779,34 @@
1123 compression_name = dflt_deflate;
1124 }
1125
1126- /* deflate it */
1127- if (p->conf.compress_cache_dir->used) {
1128- if (0 == deflate_file_to_file(srv, con, p,
1129- con->physical.path, sce, compression_type)) {
1130- buffer *mtime;
1131+ /* try matching etag of compressed version */
1132+ buffer_copy_string_buffer(srv->tmp_buf, sce->etag);
1133+ buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("-"));
1134+ buffer_append_string(srv->tmp_buf, compression_name);
1135+ etag_mutate(con->physical.etag, srv->tmp_buf);
1136
1137- response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
1138-
1139- mtime = strftime_cache_get(srv, sce->st.st_mtime);
1140- response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
1141-
1142- etag_mutate(con->physical.etag, sce->etag);
1143- response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
1144-
1145- response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
1146-
1147- return HANDLER_GO_ON;
1148- }
1149- } else if (0 == deflate_file_to_buffer(srv, con, p,
1150- con->physical.path, sce, compression_type)) {
1151- buffer *mtime;
1152-
1153+ if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
1154 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
1155-
1156- mtime = strftime_cache_get(srv, sce->st.st_mtime);
1157+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
1158 response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
1159-
1160- etag_mutate(con->physical.etag, sce->etag);
1161 response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
1162-
1163- response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
1164-
1165 return HANDLER_FINISHED;
1166 }
1167- break;
1168+
1169+ /* deflate it */
1170+ if (p->conf.compress_cache_dir->used) {
1171+ if (0 != deflate_file_to_file(srv, con, p, con->physical.path, sce, compression_type))
1172+ return HANDLER_GO_ON;
1173+ } else {
1174+ if (0 != deflate_file_to_buffer(srv, con, p, con->physical.path, sce, compression_type))
1175+ return HANDLER_GO_ON;
1176+ }
1177+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
1178+ response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
1179+ response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
1180+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
1181+ /* let mod_staticfile handle the cached compressed files, physical path was modified */
1182+ return p->conf.compress_cache_dir->used ? HANDLER_GO_ON : HANDLER_FINISHED;
1183 }
1184 }
1185 }
170f212a
ER
1186Index: src/spawn-fcgi.c
1187===================================================================
738baab9
ER
1188--- src/spawn-fcgi.c (.../tags/lighttpd-1.4.20) (revision 2389)
1189+++ src/spawn-fcgi.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
1190@@ -58,7 +58,7 @@
1191
1192
1193 if (unixsocket) {
1194- memset(&fcgi_addr, 0, sizeof(fcgi_addr));
1195+ memset(&fcgi_addr_un, 0, sizeof(fcgi_addr_un));
1196
1197 fcgi_addr_un.sun_family = AF_UNIX;
1198 strcpy(fcgi_addr_un.sun_path, unixsocket);
1199@@ -72,12 +72,13 @@
1200 socket_type = AF_UNIX;
1201 fcgi_addr = (struct sockaddr *) &fcgi_addr_un;
1202 } else {
1203+ memset(&fcgi_addr_in, 0, sizeof(fcgi_addr_in));
1204 fcgi_addr_in.sin_family = AF_INET;
1205- if (addr != NULL) {
1206- fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
1207- } else {
1208- fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
1209- }
1210+ if (addr != NULL) {
1211+ fcgi_addr_in.sin_addr.s_addr = inet_addr(addr);
1212+ } else {
1213+ fcgi_addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
1214+ }
1215 fcgi_addr_in.sin_port = htons(port);
1216 servlen = sizeof(fcgi_addr_in);
1217
709c1a0b
ER
1218Index: src/mod_auth.c
1219===================================================================
738baab9
ER
1220--- src/mod_auth.c (.../tags/lighttpd-1.4.20) (revision 2389)
1221+++ src/mod_auth.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
1222@@ -115,7 +115,7 @@
1223 PATCH(auth_ldap_starttls);
1224 PATCH(auth_ldap_allow_empty_pw);
1225 #ifdef USE_LDAP
1226- PATCH(ldap);
1227+ p->anon_conf = s;
1228 PATCH(ldap_filter_pre);
1229 PATCH(ldap_filter_post);
1230 #endif
1231@@ -149,7 +149,7 @@
1232 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.hostname"))) {
1233 PATCH(auth_ldap_hostname);
1234 #ifdef USE_LDAP
1235- PATCH(ldap);
1236+ p->anon_conf = s;
1237 #endif
1238 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("auth.backend.ldap.base-dn"))) {
1239 PATCH(auth_ldap_basedn);
1240@@ -527,7 +527,7 @@
54b68997 1241 }
54b68997
ER
1242 }
1243
709c1a0b
ER
1244- switch(s->auth_backend) {
1245+ switch(s->auth_ldap_hostname->used) {
1246 case AUTH_BACKEND_LDAP: {
1247 handler_t ret = auth_ldap_init(srv, s);
1248 if (ret == HANDLER_ERROR)
1249@@ -554,6 +554,9 @@
1250 #endif
1251
1252 if (s->auth_ldap_hostname->used) {
1253+ /* free old context */
1254+ if (NULL != s->ldap) ldap_unbind_s(s->ldap);
1255+
1256 if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) {
1257 log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
1258
170f212a
ER
1259Index: src/http-header-glue.c
1260===================================================================
738baab9
ER
1261--- src/http-header-glue.c (.../tags/lighttpd-1.4.20) (revision 2389)
1262+++ src/http-header-glue.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
1263@@ -280,6 +280,7 @@
1264 strncpy(buf, con->request.http_if_modified_since, used_len);
1265 buf[used_len] = '\0';
1266
1267+ tm.tm_isdst = 0;
1268 if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
1269 con->http_status = 412;
1270 con->mode = DIRECT;
1271@@ -329,6 +330,7 @@
1272 strncpy(buf, con->request.http_if_modified_since, used_len);
1273 buf[used_len] = '\0';
1274
1275+ tm.tm_isdst = 0;
1276 if (NULL == strptime(buf, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
1277 /**
1278 * parsing failed, let's get out of here
709c1a0b
ER
1279Index: src/mod_fastcgi.c
1280===================================================================
738baab9
ER
1281--- src/mod_fastcgi.c (.../tags/lighttpd-1.4.20) (revision 2389)
1282+++ src/mod_fastcgi.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
1283@@ -3252,6 +3252,7 @@
1284 fcgi_connection_close(srv, hctx);
1285
1286 con->mode = DIRECT;
1287+ con->http_status = 0;
1288 con->file_started = 1; /* fcgi_extension won't touch the request afterwards */
1289 } else {
1290 /* we are done */
1291@@ -3608,47 +3609,50 @@
709c1a0b
ER
1292 "handling it in mod_fastcgi");
1293 }
1294
1295- /* the prefix is the SCRIPT_NAME,
1296- * everything from start to the next slash
1297- * this is important for check-local = "disable"
1298- *
1299- * if prefix = /admin.fcgi
1300- *
1301- * /admin.fcgi/foo/bar
1302- *
1303- * SCRIPT_NAME = /admin.fcgi
1304- * PATH_INFO = /foo/bar
1305- *
1306- * if prefix = /fcgi-bin/
1307- *
1308- * /fcgi-bin/foo/bar
1309- *
1310- * SCRIPT_NAME = /fcgi-bin/foo
1311- * PATH_INFO = /bar
1312- *
1313- * if prefix = /, and fix-root-path-name is enable
1314- *
1315- * /fcgi-bin/foo/bar
1316- *
1317- * SCRIPT_NAME = /fcgi-bin/foo
1318- * PATH_INFO = /bar
1319- *
1320- */
1321+ /* do not split path info for authorizer */
1322+ if (host->mode != FCGI_AUTHORIZER) {
1323+ /* the prefix is the SCRIPT_NAME,
1324+ * everything from start to the next slash
1325+ * this is important for check-local = "disable"
1326+ *
1327+ * if prefix = /admin.fcgi
1328+ *
1329+ * /admin.fcgi/foo/bar
1330+ *
1331+ * SCRIPT_NAME = /admin.fcgi
1332+ * PATH_INFO = /foo/bar
1333+ *
1334+ * if prefix = /fcgi-bin/
1335+ *
1336+ * /fcgi-bin/foo/bar
1337+ *
1338+ * SCRIPT_NAME = /fcgi-bin/foo
1339+ * PATH_INFO = /bar
1340+ *
1341+ * if prefix = /, and fix-root-path-name is enable
1342+ *
1343+ * /fcgi-bin/foo/bar
1344+ *
1345+ * SCRIPT_NAME = /fcgi-bin/foo
1346+ * PATH_INFO = /bar
1347+ *
1348+ */
1349
1350- /* the rewrite is only done for /prefix/? matches */
1351- if (extension->key->ptr[0] == '/' &&
1352- con->uri.path->used > extension->key->used &&
1353- NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
1354- /* rewrite uri.path and pathinfo */
1355+ /* the rewrite is only done for /prefix/? matches */
1356+ if (extension->key->ptr[0] == '/' &&
1357+ con->uri.path->used > extension->key->used &&
1358+ NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
1359+ /* rewrite uri.path and pathinfo */
1360
1361- buffer_copy_string(con->request.pathinfo, pathinfo);
1362+ buffer_copy_string(con->request.pathinfo, pathinfo);
1363
1364- con->uri.path->used -= con->request.pathinfo->used - 1;
1365- con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1366- } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
1367- buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
1368- con->uri.path->used = 1;
1369- con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1370+ con->uri.path->used -= con->request.pathinfo->used - 1;
1371+ con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1372+ } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
1373+ buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
1374+ con->uri.path->used = 1;
1375+ con->uri.path->ptr[con->uri.path->used - 1] = '\0';
1376+ }
54b68997 1377 }
54b68997 1378 }
709c1a0b 1379 } else {
170f212a
ER
1380Index: src/CMakeLists.txt
1381===================================================================
1382--- src/CMakeLists.txt (.../tags/lighttpd-1.4.20) (revision 0)
738baab9
ER
1383+++ src/CMakeLists.txt (.../branches/lighttpd-1.4.x) (revision 2389)
1384@@ -0,0 +1,598 @@
170f212a
ER
1385+INCLUDE(CheckCSourceCompiles)
1386+INCLUDE(CheckIncludeFiles)
1387+INCLUDE(CheckFunctionExists)
1388+INCLUDE(CheckVariableExists)
1389+INCLUDE(CheckTypeSize)
1390+INCLUDE(CheckLibraryExists)
1391+INCLUDE(CMakeDetermineCCompiler)
1392+INCLUDE(FindThreads)
1393+INCLUDE(FindPkgConfig)
1394+
1395+INCLUDE(LighttpdMacros)
1396+
1397+ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
1398+
1399+OPTION(WITH_XATTR "with xattr-support for the stat-cache [default: off]")
1400+OPTION(WITH_MYSQL "with mysql-support for the mod_sql_vhost [default: off]")
1401+# OPTION(WITH_POSTGRESQL "with postgress-support for the mod_sql_vhost [default: off]")
1402+OPTION(WITH_OPENSSL "with openssl-support [default: off]")
1403+OPTION(WITH_PCRE "with regex support [default: on]" ON)
1404+OPTION(WITH_WEBDAV_PROPS "with property-support for mod_webdav [default: off]")
1405+OPTION(WITH_WEBDAV_LOCKS "locks in webdav [default: off]")
1406+OPTION(WITH_BZIP "with bzip2-support for mod_compress [default: off]")
1407+OPTION(WITH_ZLIB "with deflate-support for mod_compress [default: on]" ON)
1408+OPTION(WITH_LDAP "with LDAP-support for the mod_auth [default: off]")
1409+OPTION(WITH_LUA "with lua 5.1 for mod_magnet [default: off]")
1410+# OPTION(WITH_VALGRIND "with internal support for valgrind [default: off]")
1411+# OPTION(WITH_KERBEROS5 "use Kerberos5 support with OpenSSL [default: off]")
1412+OPTION(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]")
1413+OPTION(WITH_GDBM "gdbm storage for mod_trigger_b4_dl [default: off]")
1414+OPTION(WITH_MEMCACHE "memcached storage for mod_trigger_b4_dl [default: off]")
1415+
1416+OPTION(BUILD_STATIC "build a static lighttpd with all modules added")
1417+
1418+IF(BUILD_STATIC)
1419+ SET(LIGHTTPD_STATIC 1)
1420+ELSE(BUILD_STATIC)
1421+ SET(CMAKE_SHARED_LIBRARY_PREFIX "")
1422+ENDIF(BUILD_STATIC)
1423+
1424+IF(WITH_WEBDAV_PROPS)
1425+ SET(WITH_XML 1)
1426+ SET(WITH_SQLITE3 1)
1427+ SET(WITH_UUID 1)
1428+ENDIF(WITH_WEBDAV_PROPS)
1429+
1430+CHECK_INCLUDE_FILES(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
1431+CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H)
1432+CHECK_INCLUDE_FILES(sys/event.h HAVE_SYS_EVENT_H)
1433+CHECK_INCLUDE_FILES(sys/mman.h HAVE_SYS_MMAN_H)
1434+CHECK_INCLUDE_FILES(sys/poll.h HAVE_SYS_POLL_H)
1435+CHECK_INCLUDE_FILES(sys/port.h HAVE_SYS_PORT_H)
1436+CHECK_INCLUDE_FILES(sys/prctl.h HAVE_SYS_PRCTL_H)
1437+CHECK_INCLUDE_FILES(sys/resource.h HAVE_SYS_RESOURCE_H)
1438+CHECK_INCLUDE_FILES(sys/sendfile.h HAVE_SYS_SENDFILE_H)
1439+CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H)
1440+CHECK_INCLUDE_FILES(sys/syslimits.h HAVE_SYS_SYSLIMITS_H)
1441+CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
1442+CHECK_INCLUDE_FILES(sys/uio.h HAVE_SYS_UIO_H)
1443+CHECK_INCLUDE_FILES(sys/un.h HAVE_SYS_UN_H)
1444+CHECK_INCLUDE_FILES(sys/wait.h HAVE_SYS_WAIT_H)
1445+CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
1446+CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
1447+CHECK_INCLUDE_FILES(pthread.h HAVE_PTHREAD_H)
1448+CHECK_INCLUDE_FILES(getopt.h HAVE_GETOPT_H)
1449+CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
1450+CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H)
1451+CHECK_INCLUDE_FILES(pwd.h HAVE_PWD_H)
1452+CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H)
1453+CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
1454+CHECK_INCLUDE_FILES(syslog.h HAVE_SYSLOG_H)
1455+
1456+# check for fastcgi lib, for the tests only
1457+CHECK_INCLUDE_FILES(fastcgi.h HAVE_FASTCGI_H)
1458+CHECK_INCLUDE_FILES(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H)
1459+
1460+CHECK_INCLUDE_FILES(crypt.h HAVE_CRYPT_H)
1461+IF(HAVE_CRYPT_H)
1462+ ## check if we need libcrypt for crypt()
1463+ CHECK_LIBRARY_EXISTS(crypt crypt "" HAVE_LIBCRYPT)
1464+ENDIF(HAVE_CRYPT_H)
1465+
1466+CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H)
1467+IF(HAVE_SYS_INOTIFY_H)
1468+ CHECK_FUNCTION_EXISTS(inotify_init HAVE_INOTIFY_INIT)
1469+ENDIF(HAVE_SYS_INOTIFY_H)
1470+
1471+SET(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
1472+CHECK_TYPE_SIZE(socklen_t HAVE_SOCKLEN_T)
1473+SET(CMAKE_EXTRA_INCLUDE_FILES)
1474+
1475+CHECK_TYPE_SIZE(long SIZEOF_LONG)
1476+CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
1477+
1478+CHECK_FUNCTION_EXISTS(chroot HAVE_CHROOT)
1479+CHECK_FUNCTION_EXISTS(crypt HAVE_CRYPT)
1480+CHECK_FUNCTION_EXISTS(epoll_ctl HAVE_EPOLL_CTL)
1481+CHECK_FUNCTION_EXISTS(fork HAVE_FORK)
1482+CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
1483+CHECK_FUNCTION_EXISTS(getuid HAVE_GETUID)
1484+CHECK_FUNCTION_EXISTS(gmtime_r HAVE_GMTIME_R)
1485+CHECK_FUNCTION_EXISTS(inet_ntop HAVE_INET_NTOP)
1486+CHECK_FUNCTION_EXISTS(kqueue HAVE_KQUEUE)
1487+CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R)
1488+CHECK_FUNCTION_EXISTS(lstat HAVE_LSTAT)
1489+CHECK_FUNCTION_EXISTS(madvise HAVE_MADVISE)
1490+CHECK_FUNCTION_EXISTS(memcpy HAVE_MEMCPY)
1491+CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET)
1492+CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
1493+CHECK_FUNCTION_EXISTS(pathconf HAVE_PATHCONF)
1494+CHECK_FUNCTION_EXISTS(poll HAVE_POLL)
1495+CHECK_FUNCTION_EXISTS(port_create HAVE_PORT_CREATE)
1496+CHECK_FUNCTION_EXISTS(prctl HAVE_PRCTL)
1497+CHECK_FUNCTION_EXISTS(pread HAVE_PREAD)
1498+CHECK_FUNCTION_EXISTS(posix_fadvise HAVE_POSIX_FADVISE)
1499+CHECK_FUNCTION_EXISTS(select HAVE_SELECT)
1500+CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE)
1501+CHECK_FUNCTION_EXISTS(send_file HAVE_SEND_FILE)
1502+CHECK_FUNCTION_EXISTS(sendfile64 HAVE_SENDFILE64)
1503+CHECK_FUNCTION_EXISTS(sendfilev HAVE_SENDFILEV)
1504+CHECK_FUNCTION_EXISTS(sigaction HAVE_SIGACTION)
1505+CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
1506+CHECK_FUNCTION_EXISTS(sigtimedwait HAVE_SIGTIMEDWAIT)
1507+CHECK_FUNCTION_EXISTS(strptime HAVE_STRPTIME)
1508+CHECK_FUNCTION_EXISTS(syslog HAVE_SYSLOG)
1509+CHECK_FUNCTION_EXISTS(writev HAVE_WRITEV)
1510+CHECK_FUNCTION_EXISTS(inet_aton HAVE_INET_ATON)
1511+CHECK_C_SOURCE_COMPILES("
1512+ #include <sys/types.h>
1513+ #include <sys/socket.h>
1514+ #include <netinet/in.h>
1515+
1516+ int main() {
1517+ struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
1518+ return 0;
1519+ }" HAVE_IPV6)
1520+
1521+## refactor me
1522+MACRO(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
1523+# reset the variables at the beginning
1524+ SET(${_include_DIR})
1525+ SET(${_link_DIR})
1526+ SET(${_link_FLAGS})
1527+ SET(${_cflags})
1528+
1529+ FIND_PROGRAM(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin )
1530+
1531+ # if pkg-config has been found
1532+ IF(${_package}CONFIG_EXECUTABLE)
1533+ SET(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}")
1534+ MESSAGE(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}")
1535+
1536+ EXEC_PROGRAM(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS)
1537+ STRING(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS})
1538+ EXEC_PROGRAM(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags)
1539+ STRING(REPLACE "\n" "" ${_cflags} ${__cflags})
1540+
1541+ ELSE(${_package}CONFIG_EXECUTABLE)
1542+ MESSAGE(STATUS "found ${_package}: no")
1543+ ENDIF(${_package}CONFIG_EXECUTABLE)
1544+ENDMACRO(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
1545+
1546+IF(WITH_XATTR)
1547+ CHECK_INCLUDE_FILES(attr/attributes.h HAVE_ATTR_ATTRIBUTES_H)
1548+ CHECK_LIBRARY_EXISTS(attr attr_get "" HAVE_XATTR)
1549+ENDIF(WITH_XATTR)
1550+
1551+IF(WITH_MYSQL)
1552+ XCONFIG(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS)
1553+
1554+ SET(CMAKE_REQUIRED_INCLUDES /usr/include/mysql)
1555+ CHECK_INCLUDE_FILES(mysql.h HAVE_MYSQL_H)
1556+ SET(CMAKE_REQUIRED_INCLUDES)
1557+ IF(HAVE_MYSQL_H)
1558+ CHECK_LIBRARY_EXISTS(mysqlclient mysql_real_connect "" HAVE_MYSQL)
1559+ ENDIF(HAVE_MYSQL_H)
1560+ENDIF(WITH_MYSQL)
1561+
1562+IF(WITH_OPENSSL)
1563+ CHECK_INCLUDE_FILES(openssl/ssl.h HAVE_OPENSSL_SSL_H)
1564+ IF(HAVE_OPENSSL_SSL_H)
1565+ CHECK_LIBRARY_EXISTS(crypto BIO_f_base64 "" HAVE_LIBCRYPTO)
1566+ IF(HAVE_LIBCRYPTO)
1567+ SET(OPENSSL_NO_KRB5 1)
1568+ CHECK_LIBRARY_EXISTS(ssl SSL_new "" HAVE_LIBSSL)
1569+ ENDIF(HAVE_LIBCRYPTO)
1570+ ENDIF(HAVE_OPENSSL_SSL_H)
1571+ENDIF(WITH_OPENSSL)
1572+
1573+IF(WITH_PCRE)
1574+ ## if we have pcre-config, use it
1575+ XCONFIG(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS)
1576+ IF(PCRE_LDFLAGS OR PCRE_CFLAGS)
1577+ MESSAGE(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}")
1578+
1579+ IF(NOT PCRE_CFLAGS STREQUAL "\n")
1580+ ## if it is empty we'll get newline returned
1581+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}")
1582+ ENDIF(NOT PCRE_CFLAGS STREQUAL "\n")
1583+
1584+ SET(HAVE_PCRE_H 1)
1585+ SET(HAVE_LIBPCRE 1)
1586+ ELSE(PCRE_LDFLAGS OR PCRE_CFLAGS)
1587+ IF(NOT WIN32)
1588+ CHECK_INCLUDE_FILES(pcre.h HAVE_PCRE_H)
1589+ CHECK_LIBRARY_EXISTS(pcre pcre_exec "" HAVE_LIBPCRE)
1590+ SET(PCRE_LDFLAGS -lpcre)
1591+ ELSE(NOT WIN32)
1592+ FIND_PATH(PCRE_INCLUDE_DIR pcre.h
1593+ /usr/local/include
1594+ /usr/include
1595+ )
1596+
1597+ SET(PCRE_NAMES pcre)
1598+ FIND_LIBRARY(PCRE_LIBRARY
1599+ NAMES ${PCRE_NAMES}
1600+ PATHS /usr/lib /usr/local/lib
1601+ )
1602+
1603+ IF(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
1604+ SET(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR})
1605+ SET(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY})
1606+ CHECK_INCLUDE_FILES(pcre.h HAVE_PCRE_H)
1607+ CHECK_LIBRARY_EXISTS(pcre pcre_exec "" HAVE_LIBPCRE)
1608+ SET(CMAKE_REQUIRED_INCLUDES)
1609+ SET(CMAKE_REQUIRED_LIBRARIES)
1610+ INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR})
1611+ ENDIF(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
1612+ ENDIF(NOT WIN32)
1613+ ENDIF(PCRE_LDFLAGS OR PCRE_CFLAGS)
1614+
1615+ IF(NOT HAVE_PCRE_H)
1616+ MESSAGE(FATAL_ERROR "pcre.h couldn't be found")
1617+ ENDIF(NOT HAVE_PCRE_H)
1618+ IF(NOT HAVE_LIBPCRE)
1619+ MESSAGE(FATAL_ERROR "libpcre couldn't be found")
1620+ ENDIF(NOT HAVE_LIBPCRE)
1621+
1622+ENDIF(WITH_PCRE)
1623+
1624+
1625+IF(WITH_XML)
1626+ XCONFIG(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS)
1627+ IF(XML2_LDFLAGS OR XML2_CFLAGS)
1628+ MESSAGE(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}")
1629+
1630+ ## if it is empty we'll get newline returned
1631+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}")
1632+
1633+ CHECK_INCLUDE_FILES(libxml/tree.h HAVE_LIBXML_H)
1634+
1635+ SET(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS})
1636+ CHECK_LIBRARY_EXISTS(xml2 xmlParseChunk "" HAVE_LIBXML)
1637+ SET(CMAKE_REQUIRED_FLAGS)
1638+ ELSE(XML2_LDFLAGS OR XML2_CFLAGS)
1639+ CHECK_INCLUDE_FILES(libxml.h HAVE_LIBXML_H)
1640+ CHECK_LIBRARY_EXISTS(xml2 xmlParseChunk "" HAVE_LIBXML)
1641+ ENDIF(XML2_LDFLAGS OR XML2_CFLAGS)
1642+
1643+ IF(NOT HAVE_LIBXML_H)
1644+ MESSAGE(FATAL_ERROR "libxml/tree.h couldn't be found")
1645+ ENDIF(NOT HAVE_LIBXML_H)
1646+ IF(NOT HAVE_LIBXML)
1647+ MESSAGE(FATAL_ERROR "libxml2 couldn't be found")
1648+ ENDIF(NOT HAVE_LIBXML)
1649+
1650+ENDIF(WITH_XML)
1651+
1652+IF(WITH_SQLITE3)
1653+ CHECK_INCLUDE_FILES(sqlite3.h HAVE_SQLITE3_H)
1654+ CHECK_LIBRARY_EXISTS(sqlite3 sqlite3_reset "" HAVE_SQLITE3)
1655+ENDIF(WITH_SQLITE3)
1656+
1657+IF(WITH_UUID)
1658+ CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_UUID_H)
1659+ CHECK_LIBRARY_EXISTS(uuid uuid_generate "" NEED_LIBUUID)
1660+ IF(NOT NEED_LIBUUID)
1661+ CHECK_FUNCTION_EXISTS(uuid_generate HAVE_LIBUUID)
1662+ ELSE(NOT NEED_LIBUUID)
1663+ SET(HAVE_LIBUUID 1)
1664+ ENDIF(NOT NEED_LIBUUID)
1665+ENDIF(WITH_UUID)
1666+
1667+IF(WITH_ZLIB)
1668+ IF(NOT WIN32)
1669+ CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H)
1670+ CHECK_LIBRARY_EXISTS(z deflate "" HAVE_LIBZ)
1671+ SET(ZLIB_LIBRARY z)
1672+ ELSE(NOT WIN32)
1673+ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
1674+ /usr/local/include
1675+ /usr/include
1676+ )
1677+
1678+ SET(ZLIB_NAMES z zlib zdll)
1679+ FIND_LIBRARY(ZLIB_LIBRARY
1680+ NAMES ${ZLIB_NAMES}
1681+ PATHS /usr/lib /usr/local/lib
1682+ )
1683+
1684+
1685+ IF(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
1686+ SET(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
1687+ SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
1688+ GET_FILENAME_COMPONENT(ZLIB_NAME ${ZLIB_LIBRARY} NAME)
1689+ CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H)
1690+ CHECK_LIBRARY_EXISTS(${ZLIB_NAME} deflate "" HAVE_LIBZ)
1691+ SET(CMAKE_REQUIRED_INCLUDES)
1692+ SET(CMAKE_REQUIRED_LIBRARIES)
1693+ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
1694+
1695+ ENDIF(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
1696+ ENDIF(NOT WIN32)
1697+ENDIF(WITH_ZLIB)
1698+
1699+IF(WITH_BZIP)
1700+ CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB_H)
1701+ CHECK_LIBRARY_EXISTS(bz2 BZ2_bzCompress "" HAVE_LIBBZ2)
1702+ENDIF(WITH_BZIP)
1703+
1704+IF(WITH_LDAP)
1705+ CHECK_INCLUDE_FILES(ldap.h HAVE_LDAP_H)
1706+ CHECK_LIBRARY_EXISTS(ldap ldap_bind "" HAVE_LIBLDAP)
1707+ CHECK_INCLUDE_FILES(lber.h HAVE_LBER_H)
1708+ CHECK_LIBRARY_EXISTS(lber ber_printf "" HAVE_LIBLBER)
1709+ SET(LDAP_DEPRECATED 1) # Using deprecated ldap api
1710+ENDIF(WITH_LDAP)
1711+
1712+IF(WITH_LUA)
1713+ pkg_search_module(LUA REQUIRED lua lua5.1)
1714+ MESSAGE(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}")
1715+ SET(HAVE_LIBLUA 1 "Have liblua")
1716+ SET(HAVE_LUA_H 1 "Have liblua header")
1717+ENDIF(WITH_LUA)
1718+
1719+IF(WITH_FAM)
1720+ CHECK_INCLUDE_FILES(fam.h HAVE_FAM_H)
1721+ CHECK_LIBRARY_EXISTS(fam FAMOpen2 "" HAVE_LIBFAM)
1722+ IF(HAVE_LIBFAM)
1723+ SET(CMAKE_REQUIRED_LIBRARIES fam)
1724+ CHECK_FUNCTION_EXISTS(FAMNoExists HAVE_FAMNOEXISTS)
1725+ ENDIF(HAVE_LIBFAM)
1726+ENDIF(WITH_FAM)
1727+
1728+IF(WITH_GDBM)
1729+ CHECK_INCLUDE_FILES(gdbm.h HAVE_GDBM_H)
1730+ CHECK_LIBRARY_EXISTS(gdbm gdbm_open "" HAVE_GDBM)
1731+ENDIF(WITH_GDBM)
1732+
1733+IF(WITH_MEMCACHE)
1734+ CHECK_INCLUDE_FILES(memcache.h HAVE_MEMCACHE_H)
1735+ CHECK_LIBRARY_EXISTS(memcache mc_new "" HAVE_MEMCACHE)
1736+ENDIF(WITH_MEMCACHE)
1737+
1738+IF(NOT BUILD_STATIC)
1739+ CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H)
1740+ENDIF(NOT BUILD_STATIC)
1741+
1742+IF(HAVE_DLFCN_H)
1743+ CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
1744+ENDIF(HAVE_DLFCN_H)
1745+
738baab9
ER
1746+SET(LIGHTTPD_VERSION_ID 10400)
1747+SET(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
1748+SET(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
1749+EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE)
170f212a
ER
1750+
1751+IF(NOT SBINDIR)
1752+ SET(SBINDIR "sbin")
1753+ENDIF(NOT SBINDIR)
1754+
1755+IF(NOT LIGHTTPD_MODULES_DIR)
1756+ SET(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
1757+ENDIF(NOT LIGHTTPD_MODULES_DIR)
1758+
1759+IF(NOT WIN32)
738baab9 1760+ SET(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}")
170f212a 1761+ELSE(NOT WIN32)
738baab9
ER
1762+ ## We use relative path in windows
1763+ SET(LIGHTTPD_LIBRARY_DIR "lib")
170f212a
ER
1764+ENDIF(NOT WIN32)
1765+
1766+## Write out config.h
1767+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
1768+
1769+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
1770+
1771+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
1772+
1773+SET(COMMON_SRC
1774+ buffer.c log.c
1775+ keyvalue.c chunk.c
1776+ http_chunk.c stream.c fdevent.c
1777+ stat_cache.c plugin.c joblist.c etag.c array.c
1778+ data_string.c data_count.c data_array.c
1779+ data_integer.c md5.c data_fastcgi.c
1780+ fdevent_select.c fdevent_linux_rtsig.c
1781+ fdevent_poll.c fdevent_linux_sysepoll.c
1782+ fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c
1783+ data_config.c bitset.c
1784+ inet_ntop_cache.c crc32.c
1785+ connections-glue.c
1786+ configfile-glue.c
1787+ http-header-glue.c
1788+ splaytree.c network_writev.c
1789+ network_write.c network_linux_sendfile.c
1790+ network_freebsd_sendfile.c
1791+ network_solaris_sendfilev.c network_openssl.c
1792+ status_counter.c
1793+)
1794+
1795+IF(WIN32)
1796+ MESSAGE(STATUS "Adding local getopt implementation.")
1797+ SET(COMMON_SRC ${COMMON_SRC} xgetopt.c)
1798+ENDIF(WIN32)
1799+
1800+ADD_EXECUTABLE(lemon lemon.c)
1801+
1802+## Build parsers by using lemon...
1803+LEMON_PARSER(configparser.y)
1804+LEMON_PARSER(mod_ssi_exprparser.y)
1805+
1806+SET(L_INSTALL_TARGETS)
1807+
1808+ADD_EXECUTABLE(spawn-fcgi spawn-fcgi.c)
1809+SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} spawn-fcgi)
1810+
1811+ADD_EXECUTABLE(lighttpd
1812+ server.c
1813+ response.c
1814+ connections.c
1815+ network.c
1816+ configfile.c
1817+ configparser.c
1818+ request.c
1819+ proc_open.c
1820+ ${COMMON_SRC}
1821+)
1822+SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
1823+
1824+ADD_AND_INSTALL_LIBRARY(mod_access mod_access.c)
1825+ADD_AND_INSTALL_LIBRARY(mod_accesslog mod_accesslog.c)
1826+ADD_AND_INSTALL_LIBRARY(mod_alias mod_alias.c)
1827+ADD_AND_INSTALL_LIBRARY(mod_auth "mod_auth.c;http_auth_digest.c;http_auth.c")
1828+IF(NOT WIN32)
1829+ADD_AND_INSTALL_LIBRARY(mod_cgi mod_cgi.c)
1830+ENDIF(NOT WIN32)
1831+ADD_AND_INSTALL_LIBRARY(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c")
1832+ADD_AND_INSTALL_LIBRARY(mod_compress mod_compress.c)
1833+ADD_AND_INSTALL_LIBRARY(mod_dirlisting mod_dirlisting.c)
1834+ADD_AND_INSTALL_LIBRARY(mod_evasive mod_evasive.c)
1835+ADD_AND_INSTALL_LIBRARY(mod_evhost mod_evhost.c)
1836+ADD_AND_INSTALL_LIBRARY(mod_expire mod_expire.c)
1837+ADD_AND_INSTALL_LIBRARY(mod_extforward mod_extforward.c)
1838+ADD_AND_INSTALL_LIBRARY(mod_fastcgi mod_fastcgi.c)
1839+ADD_AND_INSTALL_LIBRARY(mod_flv_streaming mod_flv_streaming.c)
1840+ADD_AND_INSTALL_LIBRARY(mod_indexfile mod_indexfile.c)
1841+ADD_AND_INSTALL_LIBRARY(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
1842+ADD_AND_INSTALL_LIBRARY(mod_mysql_vhost mod_mysql_vhost.c)
1843+ADD_AND_INSTALL_LIBRARY(mod_proxy mod_proxy.c)
1844+ADD_AND_INSTALL_LIBRARY(mod_redirect mod_redirect.c)
1845+ADD_AND_INSTALL_LIBRARY(mod_rewrite mod_rewrite.c)
1846+ADD_AND_INSTALL_LIBRARY(mod_rrdtool mod_rrdtool.c)
1847+ADD_AND_INSTALL_LIBRARY(mod_scgi mod_scgi.c)
1848+ADD_AND_INSTALL_LIBRARY(mod_secdownload mod_secure_download.c)
1849+ADD_AND_INSTALL_LIBRARY(mod_setenv mod_setenv.c)
1850+ADD_AND_INSTALL_LIBRARY(mod_simple_vhost mod_simple_vhost.c)
1851+ADD_AND_INSTALL_LIBRARY(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c")
1852+ADD_AND_INSTALL_LIBRARY(mod_staticfile mod_staticfile.c)
1853+ADD_AND_INSTALL_LIBRARY(mod_status mod_status.c)
1854+ADD_AND_INSTALL_LIBRARY(mod_trigger_b4_dl mod_trigger_b4_dl.c)
1855+ADD_AND_INSTALL_LIBRARY(mod_uploadprogress mod_uploadprogress.c)
1856+ADD_AND_INSTALL_LIBRARY(mod_userdir mod_userdir.c)
1857+ADD_AND_INSTALL_LIBRARY(mod_usertrack mod_usertrack.c)
1858+ADD_AND_INSTALL_LIBRARY(mod_webdav mod_webdav.c)
1859+
1860+IF(HAVE_PCRE_H)
1861+ ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${PCRE_LDFLAGS})
1862+ ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS})
1863+ ADD_TARGET_PROPERTIES(mod_rewrite LINK_FLAGS ${PCRE_LDFLAGS})
1864+ ADD_TARGET_PROPERTIES(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS})
1865+ ADD_TARGET_PROPERTIES(mod_dirlisting LINK_FLAGS ${PCRE_LDFLAGS})
1866+ ADD_TARGET_PROPERTIES(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS})
1867+ ADD_TARGET_PROPERTIES(mod_redirect LINK_FLAGS ${PCRE_LDFLAGS})
1868+ ADD_TARGET_PROPERTIES(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
1869+ ADD_TARGET_PROPERTIES(mod_ssi LINK_FLAGS ${PCRE_LDFLAGS})
1870+ ADD_TARGET_PROPERTIES(mod_ssi COMPILE_FLAGS ${PCRE_CFLAGS})
1871+ ADD_TARGET_PROPERTIES(mod_trigger_b4_dl LINK_FLAGS ${PCRE_LDFLAGS})
1872+ ADD_TARGET_PROPERTIES(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS})
1873+ENDIF(HAVE_PCRE_H)
1874+
1875+ADD_TARGET_PROPERTIES(mod_magnet LINK_FLAGS ${LUA_LDFLAGS})
1876+ADD_TARGET_PROPERTIES(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS})
1877+
1878+ADD_TARGET_PROPERTIES(mod_cml LINK_FLAGS ${LUA_LDFLAGS})
1879+ADD_TARGET_PROPERTIES(mod_cml COMPILE_FLAGS ${LUA_CFLAGS})
1880+
1881+IF(HAVE_MYSQL_H AND HAVE_LIBMYSQL)
1882+ TARGET_LINK_LIBRARIES(mod_mysql_vhost mysqlclient)
1883+ INCLUDE_DIRECTORIES(/usr/include/mysql)
1884+ENDIF(HAVE_MYSQL_H AND HAVE_LIBMYSQL)
1885+
1886+SET(L_MOD_WEBDAV)
1887+IF(HAVE_SQLITE3_H)
1888+ SET(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3)
1889+ENDIF(HAVE_SQLITE3_H)
1890+IF(HAVE_LIBXML_H)
1891+ SET_TARGET_PROPERTIES(mod_webdav PROPERTIES LINK_FLAGS ${XML2_LDFLAGS})
1892+ENDIF(HAVE_LIBXML_H)
1893+IF(HAVE_UUID_H)
1894+ IF(NEED_LIBUUID)
1895+ SET(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid)
1896+ ENDIF(NEED_LIBUUID)
1897+ENDIF(HAVE_UUID_H)
1898+
1899+TARGET_LINK_LIBRARIES(mod_webdav ${L_MOD_WEBDAV})
1900+
1901+SET(L_MOD_AUTH)
1902+IF(HAVE_LIBCRYPT)
1903+ SET(L_MOD_AUTH ${L_MOD_AUTH} crypt)
1904+ENDIF(HAVE_LIBCRYPT)
1905+
1906+IF(HAVE_LDAP_H)
1907+ SET(L_MOD_AUTH ${L_MOD_AUTH} ldap lber)
1908+ENDIF(HAVE_LDAP_H)
1909+TARGET_LINK_LIBRARIES(mod_auth ${L_MOD_AUTH})
1910+
1911+IF(HAVE_ZLIB_H)
1912+ IF(HAVE_BZLIB_H)
1913+ TARGET_LINK_LIBRARIES(mod_compress ${ZLIB_LIBRARY} bz2)
1914+ ELSE(HAVE_BZLIB_H)
1915+ TARGET_LINK_LIBRARIES(mod_compress ${ZLIB_LIBRARY})
1916+ ENDIF(HAVE_BZLIB_H)
1917+ENDIF(HAVE_ZLIB_H)
1918+
1919+IF(HAVE_LIBFAM)
1920+ TARGET_LINK_LIBRARIES(lighttpd fam)
1921+ENDIF(HAVE_LIBFAM)
1922+
1923+IF(HAVE_GDBM_H)
1924+ TARGET_LINK_LIBRARIES(mod_trigger_b4_dl gdbm)
1925+ENDIF(HAVE_GDBM_H)
1926+
1927+IF(HAVE_MEMCACHE_H)
1928+ TARGET_LINK_LIBRARIES(mod_trigger_b4_dl memcache)
1929+ENDIF(HAVE_MEMCACHE_H)
1930+
1931+IF(CMAKE_COMPILER_IS_GNUCC)
1932+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic")
1933+ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
1934+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
1935+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2")
1936+ ADD_DEFINITIONS(-D_GNU_SOURCE)
1937+ENDIF(CMAKE_COMPILER_IS_GNUCC)
1938+
1939+SET_TARGET_PROPERTIES(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
1940+
1941+IF(WIN32)
1942+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND")
1943+ ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
1944+ TARGET_LINK_LIBRARIES(lighttpd ws2_32)
1945+ TARGET_LINK_LIBRARIES(mod_proxy ws2_32)
1946+ TARGET_LINK_LIBRARIES(mod_fcgi ws2_32)
1947+ TARGET_LINK_LIBRARIES(mod_scgi ws2_32)
1948+ TARGET_LINK_LIBRARIES(mod_ssi ws2_32)
1949+
1950+ IF(MINGW)
1951+ TARGET_LINK_LIBRARIES(lighttpd msvcr70)
1952+ ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS "-Wl,-subsystem,console")
1953+ ENDIF(MINGW)
1954+ENDIF(WIN32)
1955+
1956+IF(NOT BUILD_STATIC)
1957+ IF(HAVE_LIBDL)
1958+ TARGET_LINK_LIBRARIES(lighttpd dl)
1959+ ENDIF(HAVE_LIBDL)
1960+ENDIF(NOT BUILD_STATIC)
1961+
1962+IF(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
1963+ TARGET_LINK_LIBRARIES(lighttpd ssl)
1964+ TARGET_LINK_LIBRARIES(lighttpd crypto)
1965+ENDIF(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
1966+
1967+IF(NOT WIN32)
1968+INSTALL(TARGETS ${L_INSTALL_TARGETS}
1969+ RUNTIME DESTINATION ${SBINDIR}
1970+ LIBRARY DESTINATION ${LIGHTTPD_MODULES_DIR}
1971+ ARCHIVE DESTINATION ${LIGHTTPD_MODULES_DIR}/static)
1972+ELSE(NOT WIN32)
1973+## HACK to make win32 to install our libraries in desired directory..
1974+INSTALL(TARGETS lighttpd
1975+ RUNTIME DESTINATION ${SBINDIR}
1976+ ARCHIVE DESTINATION lib/static)
1977+LIST(REMOVE_ITEM L_INSTALL_TARGETS lighttpd)
1978+INSTALL(TARGETS ${L_INSTALL_TARGETS}
1979+ RUNTIME DESTINATION ${SBINDIR}/lib
1980+ LIBRARY DESTINATION lib
1981+ ARCHIVE DESTINATION lib/static)
1982+ENDIF(NOT WIN32)
1983Index: src/mod_accesslog.c
1984===================================================================
738baab9
ER
1985--- src/mod_accesslog.c (.../tags/lighttpd-1.4.20) (revision 2389)
1986+++ src/mod_accesslog.c (.../branches/lighttpd-1.4.x) (revision 2389)
1987@@ -169,13 +169,13 @@
1988 if (fields->size == 0) {
1989 fields->size = 16;
1990 fields->used = 0;
1991- fields->ptr = malloc(fields->size * sizeof(format_fields * ));
1992+ fields->ptr = malloc(fields->size * sizeof(format_field * ));
1993 } else if (fields->used == fields->size) {
1994 fields->size += 16;
1995- fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
1996+ fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
1997 }
1998
1999- fields->ptr[fields->used] = malloc(sizeof(format_fields));
2000+ fields->ptr[fields->used] = malloc(sizeof(format_field));
2001 fields->ptr[fields->used]->type = FIELD_STRING;
2002 fields->ptr[fields->used]->string = buffer_init();
2003
2004@@ -189,10 +189,10 @@
2005 if (fields->size == 0) {
2006 fields->size = 16;
2007 fields->used = 0;
2008- fields->ptr = malloc(fields->size * sizeof(format_fields * ));
2009+ fields->ptr = malloc(fields->size * sizeof(format_field * ));
2010 } else if (fields->used == fields->size) {
2011 fields->size += 16;
2012- fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
2013+ fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
2014 }
2015
2016 /* search for the terminating command */
2017@@ -211,7 +211,7 @@
2018
2019 /* found key */
2020
2021- fields->ptr[fields->used] = malloc(sizeof(format_fields));
2022+ fields->ptr[fields->used] = malloc(sizeof(format_field));
2023 fields->ptr[fields->used]->type = FIELD_FORMAT;
2024 fields->ptr[fields->used]->field = fmap[j].type;
2025 fields->ptr[fields->used]->string = NULL;
2026@@ -258,7 +258,7 @@
2027
2028 /* found key */
2029
2030- fields->ptr[fields->used] = malloc(sizeof(format_fields));
2031+ fields->ptr[fields->used] = malloc(sizeof(format_field));
2032 fields->ptr[fields->used]->type = FIELD_FORMAT;
2033 fields->ptr[fields->used]->field = fmap[j].type;
2034 fields->ptr[fields->used]->string = buffer_init();
2035@@ -291,7 +291,7 @@
2036
2037 /* found key */
2038
2039- fields->ptr[fields->used] = malloc(sizeof(format_fields));
2040+ fields->ptr[fields->used] = malloc(sizeof(format_field));
2041 fields->ptr[fields->used]->type = FIELD_FORMAT;
2042 fields->ptr[fields->used]->field = fmap[j].type;
2043 fields->ptr[fields->used]->string = NULL;
2044@@ -321,13 +321,13 @@
2045 if (fields->size == 0) {
2046 fields->size = 16;
2047 fields->used = 0;
2048- fields->ptr = malloc(fields->size * sizeof(format_fields * ));
2049+ fields->ptr = malloc(fields->size * sizeof(format_field * ));
2050 } else if (fields->used == fields->size) {
2051 fields->size += 16;
2052- fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_fields * ));
2053+ fields->ptr = realloc(fields->ptr, fields->size * sizeof(format_field * ));
2054 }
2055
2056- fields->ptr[fields->used] = malloc(sizeof(format_fields));
2057+ fields->ptr[fields->used] = malloc(sizeof(format_field));
2058 fields->ptr[fields->used]->type = FIELD_STRING;
2059 fields->ptr[fields->used]->string = buffer_init();
2060
170f212a
ER
2061@@ -540,8 +540,9 @@
2062
2063 return HANDLER_ERROR;
2064 }
2065+#ifdef FD_CLOEXEC
2066 fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
2067-
2068+#endif
2069 }
2070
2071 return HANDLER_GO_ON;
2072@@ -584,6 +585,9 @@
2073
2074 return HANDLER_ERROR;
2075 }
2076+#ifdef FD_CLOEXEC
2077+ fcntl(s->log_access_fd, F_SETFD, FD_CLOEXEC);
2078+#endif
2079 }
2080 }
2081
2082Index: src/fdevent_linux_sysepoll.c
2083===================================================================
738baab9
ER
2084--- src/fdevent_linux_sysepoll.c (.../tags/lighttpd-1.4.20) (revision 2389)
2085+++ src/fdevent_linux_sysepoll.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2086@@ -91,7 +91,7 @@
2087 if (e & EPOLLHUP) events |= FDEVENT_HUP;
2088 if (e & EPOLLPRI) events |= FDEVENT_PRI;
2089
2090- return e;
2091+ return events;
2092 }
2093
2094 static int fdevent_linux_sysepoll_event_get_fd(fdevents *ev, size_t ndx) {
738baab9
ER
2095Index: src/server.c
2096===================================================================
2097--- src/server.c (.../tags/lighttpd-1.4.20) (revision 2389)
2098+++ src/server.c (.../branches/lighttpd-1.4.x) (revision 2389)
2099@@ -210,6 +210,7 @@
2100 srv->srvconf.modules_dir = buffer_init_string(LIBRARY_DIR);
2101 srv->srvconf.network_backend = buffer_init();
2102 srv->srvconf.upload_tempdirs = array_init();
2103+ srv->srvconf.reject_expect_100_with_417 = 1;
2104
2105 /* use syslog */
2106 srv->errorlog_fd = -1;
2107@@ -844,15 +845,16 @@
2108 }
2109
2110 /* set max-conns */
2111- if (srv->srvconf.max_conns > srv->max_fds) {
2112- /* we can't have more connections than max-fds */
2113- srv->max_conns = srv->max_fds;
2114+ if (srv->srvconf.max_conns > srv->max_fds/2) {
2115+ /* we can't have more connections than max-fds/2 */
2116+ log_error_write(srv, __FILE__, __LINE__, "sdd", "can't have more connections than fds/2: ", srv->srvconf.max_conns, srv->max_fds);
2117+ srv->max_conns = srv->max_fds/2;
2118 } else if (srv->srvconf.max_conns) {
2119 /* otherwise respect the wishes of the user */
2120 srv->max_conns = srv->srvconf.max_conns;
2121 } else {
2122- /* or use the default */
2123- srv->max_conns = srv->max_fds;
2124+ /* or use the default: we really don't want to hit max-fds */
2125+ srv->max_conns = srv->max_fds/3;
2126 }
2127
2128 if (HANDLER_GO_ON != plugins_call_init(srv)) {
2129@@ -1295,8 +1297,8 @@
2130 if (srv->sockets_disabled) {
2131 /* our server sockets are disabled, why ? */
2132
2133- if ((srv->cur_fds + srv->want_fds < srv->max_fds * 0.8) && /* we have enough unused fds */
2134- (srv->conns->used < srv->max_conns * 0.9) &&
2135+ if ((srv->cur_fds + srv->want_fds < srv->max_fds * 8 / 10) && /* we have enough unused fds */
2136+ (srv->conns->used <= srv->max_conns * 9 / 10) &&
2137 (0 == graceful_shutdown)) {
2138 for (i = 0; i < srv->srv_sockets.used; i++) {
2139 server_socket *srv_socket = srv->srv_sockets.ptr[i];
2140@@ -1308,8 +1310,8 @@
2141 srv->sockets_disabled = 0;
2142 }
2143 } else {
2144- if ((srv->cur_fds + srv->want_fds > srv->max_fds * 0.9) || /* out of fds */
2145- (srv->conns->used > srv->max_conns) || /* out of connections */
2146+ if ((srv->cur_fds + srv->want_fds > srv->max_fds * 9 / 10) || /* out of fds */
2147+ (srv->conns->used >= srv->max_conns) || /* out of connections */
2148 (graceful_shutdown)) { /* graceful_shutdown */
2149
2150 /* disable server-fds */
2151@@ -1348,7 +1350,7 @@
2152
2153 if (graceful_shutdown) {
2154 log_error_write(srv, __FILE__, __LINE__, "s", "[note] graceful shutdown started");
2155- } else if (srv->conns->used > srv->max_conns) {
2156+ } else if (srv->conns->used >= srv->max_conns) {
2157 log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, connection limit reached");
2158 } else {
2159 log_error_write(srv, __FILE__, __LINE__, "s", "[note] sockets disabled, out-of-fds");
170f212a
ER
2160Index: src/log.c
2161===================================================================
738baab9
ER
2162--- src/log.c (.../tags/lighttpd-1.4.20) (revision 2389)
2163+++ src/log.c (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2164@@ -146,6 +146,10 @@
2165 /* ok, new log is open, close the old one */
2166 close(srv->errorlog_fd);
2167 srv->errorlog_fd = new_fd;
2168+#ifdef FD_CLOEXEC
2169+ /* close fd on exec (cgi) */
2170+ fcntl(srv->errorlog_fd, F_SETFD, FD_CLOEXEC);
2171+#endif
2172 }
2173 }
2174
709c1a0b
ER
2175Index: src/proc_open.c
2176===================================================================
738baab9
ER
2177--- src/proc_open.c (.../tags/lighttpd-1.4.20) (revision 2389)
2178+++ src/proc_open.c (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
2179@@ -287,32 +287,33 @@
2180 }
2181 /* }}} */
2182 /* {{{ proc_open_buffer */
2183-int proc_open_buffer(proc_handler_t *proc, const char *command, buffer *in, buffer *out, buffer *err) {
2184+int proc_open_buffer(const char *command, buffer *in, buffer *out, buffer *err) {
2185+ proc_handler_t proc;
54b68997 2186
709c1a0b
ER
2187- UNUSED(err);
2188-
2189- if (proc_open(proc, command) != 0) {
2190+ if (proc_open(&proc, command) != 0) {
2191 return -1;
2192 }
54b68997 2193
709c1a0b
ER
2194 if (in) {
2195- if (write(proc->in.fd, (void *)in->ptr, in->used) < 0) {
2196+ if (write(proc.in.fd, (void *)in->ptr, in->used) < 0) {
2197 perror("error writing pipe");
2198 return -1;
2199 }
2200 }
2201- pipe_close(&proc->in);
2202+ pipe_close(&proc.in);
54b68997 2203
709c1a0b
ER
2204 if (out) {
2205- proc_read_fd_to_buffer(proc->out.fd, out);
2206+ proc_read_fd_to_buffer(proc.out.fd, out);
2207 }
2208- pipe_close(&proc->out);
2209+ pipe_close(&proc.out);
54b68997 2210
709c1a0b
ER
2211 if (err) {
2212- proc_read_fd_to_buffer(proc->err.fd, err);
2213+ proc_read_fd_to_buffer(proc.err.fd, err);
54b68997 2214 }
709c1a0b
ER
2215- pipe_close(&proc->err);
2216+ pipe_close(&proc.err);
54b68997 2217
709c1a0b
ER
2218+ proc_close(&proc);
2219+
54b68997
ER
2220 return 0;
2221 }
709c1a0b
ER
2222 /* }}} */
2223@@ -366,7 +367,7 @@
2224 RESET();
2225
2226 fprintf(stdout, "test: echo 321 with read\n"); fflush(stdout);
2227- if (proc_open_buffer(&proc, "echo 321", NULL, out, err) != 0) {
2228+ if (proc_open_buffer("echo 321", NULL, out, err) != 0) {
2229 ERROR_OUT();
2230 }
2231 fprintf(stdout, "result: ->%s<-\n\n", out->ptr); fflush(stdout);
2232@@ -374,7 +375,7 @@
2233
2234 fprintf(stdout, "test: echo 123 | " CMD_CAT "\n"); fflush(stdout);
2235 buffer_copy_string_len(in, CONST_STR_LEN("123\n"));
2236- if (proc_open_buffer(&proc, CMD_CAT, in, out, err) != 0) {
2237+ if (proc_open_buffer(CMD_CAT, in, out, err) != 0) {
2238 ERROR_OUT();
2239 }
2240 fprintf(stdout, "result: ->%s<-\n\n", out->ptr); fflush(stdout);
2241Index: src/proc_open.h
54b68997 2242===================================================================
738baab9
ER
2243--- src/proc_open.h (.../tags/lighttpd-1.4.20) (revision 2389)
2244+++ src/proc_open.h (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b 2245@@ -22,4 +22,4 @@
54b68997 2246
709c1a0b
ER
2247 int proc_close(proc_handler_t *ht);
2248 int proc_open(proc_handler_t *ht, const char *command);
2249-int proc_open_buffer(proc_handler_t *ht, const char *command, buffer *in, buffer *out, buffer *err);
2250+int proc_open_buffer(const char *command, buffer *in, buffer *out, buffer *err);
170f212a
ER
2251Index: tests/mod-proxy.t
2252===================================================================
738baab9
ER
2253--- tests/mod-proxy.t (.../tags/lighttpd-1.4.20) (revision 2389)
2254+++ tests/mod-proxy.t (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2255@@ -8,14 +8,24 @@
2256
2257 use strict;
2258 use IO::Socket;
2259-use Test::More tests => 6;
2260+use Test::More tests => 9;
2261 use LightyTest;
2262
2263 my $tf_real = LightyTest->new();
2264 my $tf_proxy = LightyTest->new();
2265
2266 my $t;
2267+my $php_child = -1;
2268
2269+my $phpbin = (defined $ENV{'PHP'} ? $ENV{'PHP'} : '/usr/bin/php-cgi');
2270+$ENV{'PHP'} = $phpbin;
2271+
2272+SKIP: {
2273+ skip "PHP already running on port 1026", 1 if $tf_real->listening_on(1026);
2274+ skip "no php binary found", 1 unless -x $phpbin;
2275+ ok(-1 != ($php_child = $tf_real->spawnfcgi($phpbin, 1026)), "Spawning php");
2276+}
2277+
2278 ## we need two procs
2279 ## 1. the real webserver
2280 ## 2. the proxy server
2281@@ -26,9 +36,9 @@
2282 $tf_proxy->{PORT} = 2050;
2283 $tf_proxy->{CONFIGFILE} = 'proxy.conf';
2284
2285-ok($tf_real->start_proc == 0, "Starting lighttpd") or die();
2286+ok($tf_real->start_proc == 0, "Starting lighttpd") or goto cleanup;
2287
2288-ok($tf_proxy->start_proc == 0, "Starting lighttpd as proxy") or die();
2289+ok($tf_proxy->start_proc == 0, "Starting lighttpd as proxy") or goto cleanup;
2290
2291 $t->{REQUEST} = ( <<EOF
2292 GET /index.html HTTP/1.0
2293@@ -46,6 +56,31 @@
2294 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Server' => 'Apache 1.3.29' } ];
2295 ok($tf_proxy->handle_http($t) == 0, 'drop Server from real server');
2296
2297+SKIP: {
2298+ skip "no PHP running on port 1026", 1 unless $tf_real->listening_on(1026);
2299+ $t->{REQUEST} = ( <<EOF
2300+GET /rewrite/all/some+test%3axxx%20with%20space HTTP/1.0
2301+Host: www.example.org
2302+EOF
2303+ );
2304+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/some+test%3axxx%20with%20space' } ];
2305+ ok($tf_proxy->handle_http($t) == 0, 'rewrited urls work with encoded path');
2306+}
2307+
2308 ok($tf_proxy->stop_proc == 0, "Stopping lighttpd proxy");
2309
2310 ok($tf_real->stop_proc == 0, "Stopping lighttpd");
2311+
2312+SKIP: {
2313+ skip "PHP not started, cannot stop it", 1 unless $php_child != -1;
2314+ ok(0 == $tf_real->endspawnfcgi($php_child), "Stopping php");
2315+ $php_child = -1;
2316+}
2317+
2318+exit 0;
2319+
2320+cleanup:
2321+
2322+$tf_real->endspawnfcgi($php_child) if $php_child != -1;
2323+
2324+die();
2325Index: tests/CMakeLists.txt
2326===================================================================
2327--- tests/CMakeLists.txt (.../tags/lighttpd-1.4.20) (revision 0)
738baab9 2328+++ tests/CMakeLists.txt (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2329@@ -0,0 +1,34 @@
2330+SET(T_FILES
2331+ prepare.sh
2332+ cachable.t
2333+ core-404-handler.t
2334+ core-condition.t
2335+ core-keepalive.t
2336+ core-request.t
2337+ core-response.t
2338+ core.t
2339+ core-var-include.t
2340+ lowercase.t
2341+ mod-access.t
2342+ mod-auth.t
2343+ mod-cgi.t
2344+ mod-compress.t
2345+ mod-extforward.t
2346+ mod-fastcgi.t
2347+ mod-proxy.t
2348+ mod-redirect.t
2349+ mod-rewrite.t
2350+ mod-secdownload.t
2351+ mod-setenv.t
2352+ mod-ssi.t
2353+ mod-userdir.t
2354+ request.t
2355+ symlink.t
2356+)
2357+
2358+FOREACH(it ${T_FILES})
2359+ ADD_TEST(${it} "${lighttpd_SOURCE_DIR}/tests/wrapper.sh"
2360+ "${lighttpd_SOURCE_DIR}/tests"
2361+ "${lighttpd_BINARY_DIR}"
2362+ "${lighttpd_SOURCE_DIR}/tests/${it}")
2363+ENDFOREACH(it)
2364Index: tests/SConscript
2365===================================================================
738baab9
ER
2366--- tests/SConscript (.../tags/lighttpd-1.4.20) (revision 2389)
2367+++ tests/SConscript (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2368@@ -23,6 +23,7 @@
2369 mod-auth.t \
2370 mod-cgi.t \
2371 mod-compress.t \
2372+ mod-compress.conf \
2373 mod-fastcgi.t \
2374 mod-redirect.t \
2375 mod-userdir.t \
2ed0f534
ER
2376Index: tests/mod-compress.conf
2377===================================================================
2378--- tests/mod-compress.conf (.../tags/lighttpd-1.4.20) (revision 0)
738baab9 2379+++ tests/mod-compress.conf (.../branches/lighttpd-1.4.x) (revision 2389)
2ed0f534
ER
2380@@ -0,0 +1,32 @@
2381+debug.log-request-handling = "enable"
2382+debug.log-response-header = "disable"
2383+debug.log-request-header = "disable"
2384+
2385+server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
2386+server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
2387+
2388+## bind to port (default: 80)
2389+server.port = 2048
2390+
2391+## bind to localhost (default: all interfaces)
2392+server.bind = "localhost"
2393+server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
2394+server.name = "www.example.org"
2395+
2396+server.modules = (
2397+ "mod_compress"
2398+)
2399+
2400+######################## MODULE CONFIG ############################
2401+
2402+mimetype.assign = (
2403+ ".html" => "text/html",
2404+ ".txt" => "text/plain",
2405+)
2406+
2407+$HTTP["host"] == "cache.example.org" {
2408+ compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/"
2409+}
2410+compress.filetype = ("text/plain", "text/html")
2411+
2412+compress.allowed-encodings = ( "gzip", "deflate" )
709c1a0b
ER
2413Index: tests/mod-fastcgi.t
2414===================================================================
738baab9
ER
2415--- tests/mod-fastcgi.t (.../tags/lighttpd-1.4.20) (revision 2389)
2416+++ tests/mod-fastcgi.t (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
2417@@ -7,7 +7,7 @@
2418 }
54b68997 2419
709c1a0b
ER
2420 use strict;
2421-use Test::More tests => 49;
2422+use Test::More tests => 50;
2423 use LightyTest;
54b68997 2424
709c1a0b
ER
2425 my $tf = LightyTest->new();
2426@@ -215,7 +215,7 @@
54b68997 2427 }
a34aaa25 2428
709c1a0b
ER
2429 SKIP: {
2430- skip "no fcgi-auth found", 4 unless -x $tf->{BASEDIR}."/tests/fcgi-auth" || -x $tf->{BASEDIR}."/tests/fcgi-auth.exe";
2431+ skip "no fcgi-auth found", 5 unless -x $tf->{BASEDIR}."/tests/fcgi-auth" || -x $tf->{BASEDIR}."/tests/fcgi-auth.exe";
2432
2433 $tf->{CONFIGFILE} = 'fastcgi-auth.conf';
2434 ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
2435@@ -235,6 +235,14 @@
2436 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
2437 ok($tf->handle_http($t) == 0, 'FastCGI - Auth');
a34aaa25 2438
709c1a0b
ER
2439+ $t->{REQUEST} = ( <<EOF
2440+GET /expire/access.txt?ok HTTP/1.0
2441+Host: www.example.org
2442+EOF
2443+ );
2444+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
2445+ ok($tf->handle_http($t) == 0, 'FastCGI - Auth in subdirectory');
2446+
2447 ok($tf->stop_proc == 0, "Stopping lighttpd");
2448 }
09cf44bb 2449
170f212a
ER
2450Index: tests/mod-rewrite.t
2451===================================================================
738baab9
ER
2452--- tests/mod-rewrite.t (.../tags/lighttpd-1.4.20) (revision 2389)
2453+++ tests/mod-rewrite.t (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2454@@ -8,7 +8,7 @@
2455
2456 use strict;
2457 use IO::Socket;
2458-use Test::More tests => 8;
2459+use Test::More tests => 7;
2460 use LightyTest;
2461
2462 my $tf = LightyTest->new();
2463@@ -35,7 +35,7 @@
2464 );
2465 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
2466 ok($tf->handle_http($t) == 0, 'valid request');
2467-
2468+
2469 $t->{REQUEST} = ( <<EOF
2470 GET /rewrite/foo?a=b HTTP/1.0
2471 Host: www.example.org
2472@@ -52,14 +52,6 @@
2473 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'bar&a=b' } ];
2474 ok($tf->handle_http($t) == 0, 'valid request');
2475
2476- $t->{REQUEST} = ( <<EOF
2477-GET %2Frewrite/f%6Fo?a=b HTTP/1.0
2478-Host: www.example.org
2479-EOF
2480- );
2481- $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'a=b' } ];
2482- ok($tf->handle_http($t) == 0, 'valid request with url encoded characters');
2483-
2484 ok($tf->stop_proc == 0, "Stopping lighttpd");
2485 }
2486
738baab9
ER
2487Index: tests/lighttpd.conf
2488===================================================================
2489--- tests/lighttpd.conf (.../tags/lighttpd-1.4.20) (revision 2389)
2490+++ tests/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 2389)
2491@@ -217,4 +217,5 @@
2492
2493 $HTTP["host"] == "etag.example.org" {
2494 static-file.etags = "disable"
2495+ compress.filetype = ()
2496 }
709c1a0b 2497Index: tests/fastcgi-auth.conf
54b68997 2498===================================================================
738baab9
ER
2499--- tests/fastcgi-auth.conf (.../tags/lighttpd-1.4.20) (revision 2389)
2500+++ tests/fastcgi-auth.conf (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
2501@@ -89,6 +89,7 @@
2502 "bin-path" => env.SRCDIR + "/fcgi-auth",
2503 "mode" => "authorizer",
2504 "docroot" => env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/",
2505+ "check-local" => "disable",
54b68997 2506
709c1a0b
ER
2507 )
2508 )
170f212a
ER
2509Index: tests/proxy.conf
2510===================================================================
738baab9
ER
2511--- tests/proxy.conf (.../tags/lighttpd-1.4.20) (revision 2389)
2512+++ tests/proxy.conf (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2513@@ -122,7 +122,8 @@
2514 url.redirect = ( "^/redirect/$" => "http://localhost:2048/" )
2515
2516 url.rewrite = ( "^/rewrite/foo($|\?.+)" => "/indexfile/rewrite.php$1",
2517- "^/rewrite/bar(?:$|\?(.+))" => "/indexfile/rewrite.php?bar&$1" )
2518+ "^/rewrite/bar(?:$|\?(.+))" => "/indexfile/rewrite.php?bar&$1",
2519+ "^/rewrite/all(/.*)$" => "/indexfile/rewrite.php?$1" )
2520
2521 expire.url = ( "/expire/access" => "access 2 hours",
2522 "/expire/modification" => "access plus 1 seconds 2 minutes")
2523Index: tests/Makefile.am
2524===================================================================
738baab9
ER
2525--- tests/Makefile.am (.../tags/lighttpd-1.4.20) (revision 2389)
2526+++ tests/Makefile.am (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2527@@ -38,6 +38,7 @@
2528 mod-auth.t \
2529 mod-cgi.t \
2530 mod-compress.t \
2531+ mod-compress.conf \
2532 mod-fastcgi.t \
2533 mod-redirect.t \
2534 mod-rewrite.t \
2ed0f534
ER
2535Index: tests/mod-compress.t
2536===================================================================
738baab9
ER
2537--- tests/mod-compress.t (.../tags/lighttpd-1.4.20) (revision 2389)
2538+++ tests/mod-compress.t (.../branches/lighttpd-1.4.x) (revision 2389)
2ed0f534
ER
2539@@ -8,12 +8,14 @@
2540
2541 use strict;
2542 use IO::Socket;
2543-use Test::More tests => 10;
2544+use Test::More tests => 11;
2545 use LightyTest;
2546
2547 my $tf = LightyTest->new();
2548 my $t;
2549
2550+$tf->{CONFIGFILE} = 'mod-compress.conf';
2551+
2552 ok($tf->start_proc == 0, "Starting lighttpd") or die();
2553
2554 $t->{REQUEST} = ( <<EOF
2555@@ -88,5 +90,14 @@
2556 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Type' => "text/plain" } ];
2557 ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding');
2558
2559+$t->{REQUEST} = ( <<EOF
2560+GET /index.txt HTTP/1.0
2561+Accept-Encoding: bzip2, gzip, deflate
2562+Host: cache.example.org
2563+EOF
2564+ );
2565+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain" } ];
2566+ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled');
2567
2568+
2569 ok($tf->stop_proc == 0, "Stopping lighttpd");
170f212a
ER
2570Index: doc/redirect.txt
2571===================================================================
738baab9
ER
2572--- doc/redirect.txt (.../tags/lighttpd-1.4.20) (revision 2389)
2573+++ doc/redirect.txt (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2574@@ -39,3 +39,9 @@
2575 $HTTP["host"] =~ "^www\.(.*)" {
2576 url.redirect = ( "^/(.*)" => "http://%1/$1" )
2577 }
2578+
2579+Warning
2580+=======
2581+
2582+Do NOT use mod_redirect to protect specific urls, as the original url passed from the client
2583+is matched against your rules, for example strings like "/abc/../xyz%2f/path".
2ed0f534
ER
2584Index: doc/compress.txt
2585===================================================================
738baab9
ER
2586--- doc/compress.txt (.../tags/lighttpd-1.4.20) (revision 2389)
2587+++ doc/compress.txt (.../branches/lighttpd-1.4.x) (revision 2389)
2ed0f534
ER
2588@@ -6,13 +6,7 @@
2589 Module: mod_compress
2590 --------------------
2591
2592-:Author: Jan Kneschke
2593-:Date: $Date$
2594-:Revision: $Revision$
2595
2596-:abstract:
2597- a nice, short abstrace about the module
2598-
2599 .. meta::
2600 :keywords: lighttpd, compress
2601
2602@@ -22,16 +16,57 @@
2603 ===========
2604
2605 Output compression reduces the network load and can improve the overall
2606-throughput of the webserver.
2607+throughput of the webserver. All major http-clients support compression by
2608+announcing it in the Accept-Encoding header. This is used to negotiate the
2609+most suitable compression method. We support deflate, gzip and bzip2.
2610
2611-Only static content is supported up to now.
2612+deflate (RFC1950, RFC1951) and gzip (RFC1952) depend on zlib while bzip2
2613+depends on libbzip2. bzip2 is only supported by lynx and some other console
2614+text-browsers.
2615
2616-The server negotiates automaticly which compression method is used.
2617-Supported are gzip, deflate, bzip.
2618+We currently limit to compression support to static files.
2619
2620+Caching
2621+-------
2622+
2623+mod_compress can store compressed files on disk to optimize the compression
2624+on a second request away. As soon as compress.cache-dir is set the files are
2625+compressed.
2626+
2627+(You will need to create the cache directory if it doesn't already exist. The web server will not do this for you. The directory will also need the proper ownership. For Debian/Ubuntu the user and group ids should both be www-data.)
2628+
2629+The names of the cache files are made of the filename, the compression method
2630+and the etag associated to the file.
2631+
2632+Cleaning the cache is left to the user. A cron job deleting files older than
2633+10 days could do it: ::
2634+
2635+ find /var/www/cache -type f -mtime +10 | xargs -r rm
2636+
2637+Limitations
2638+-----------
2639+
2640+The module limits the compression of files to files smaller than 128 MByte and
2641+larger than 128 Byte.
2642+
2643+The lower limit is set as small files tend to become larger by compressing due
2644+to the compression headers, the upper limit is set to work sensibly with
2645+memory and cpu-time.
2646+
2647+Directories containing a tilde ('~') are not created automatically (See ticket
2648+#113). To enable compression for user dirs you have to create the directories
2649+by hand in the cache directory.
2650+
2651 Options
2652 =======
2653
2654+compress.allowed-encodings
2655+ override default set of allowed encodings
2656+
2657+ e.g.: ::
2658+
2659+ compress.allowed-encodings = ("bzip2", "gzip", "deflate")
2660+
2661 compress.cache-dir
2662 name of the directory where compressed content will be cached
2663
2664@@ -47,20 +82,111 @@
2665 Default: not set, compress the file for every request
2666
2667 compress.filetype
2668- mimetypes where might get compressed
2669+ mimetypes which might get compressed
2670
2671 e.g.: ::
2672
2673 compress.filetype = ("text/plain", "text/html")
2674
2675+ Keep in mind that compressed JavaScript and CSS files are broken in some
2676+ browsers. Not setting any filetypes will result in no files being compressed.
2677+
2678+ NOTE: You have to specify the full mime-type! If you also define a charset, for example, you have to use "text/plain; charset=utf-8" instead of just "text/plain".
2679+
2680 Default: not set
2681
2682+compress.max-filesize
2683+ maximum size of the original file to be compressed kBytes.
2684
2685+ This is meant to protect the server against DoSing as compressing large
2686+ (let's say 1Gbyte) takes a lot of time and would delay the whole operation
2687+ of the server.
2688+
2689+ There is a hard upper limit of 128Mbyte.
2690+
2691+ Default: unlimited (== hard-limit of 128MByte)
2692+
2693+Display compressed files
2694+========================
2695+
2696+If you enable mod_compress, and you want to force clients to uncompress and display compressed text files, please force mimetype to nothing.
2697+Exemple :
2698+If you want to add headers for uncompress and display diff.gz files , add this section in your conf : ::
2699+
2700+ $HTTP["url"] =~ "\.diff\.gz" {
2701+ setenv.add-response-header = ( "Content-Encoding" => "gzip" )
2702+ mimetype.assign = ()
2703+ }
2704+
2705+
2706 Compressing Dynamic Content
2707 ===========================
2708
2709+PHP
2710+---
2711+
2712 To compress dynamic content with PHP please enable ::
2713
2714 zlib.output_compression = 1
2715+ zlib.output_handler = On
2716
2717 in the php.ini as PHP provides compression support by itself.
2718+
2719+mod_compress of lighttpd 1.5 r1992 may not set correct Content-Encoding with php-fcgi. A solution to that problem would be:
2720+
2721+1.disable mod_compress when request a php file::
2722+
2723+ $HTTP["url"] !~ "\.php$" {
2724+ compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml")
2725+ }
2726+
2727+2.enable mod_setenv of your lighttpd::
2728+
2729+ server.modules += ( "mod_setenv" )
2730+
2731+3.manually set Content-Encoding::
2732+
2733+ $HTTP["url"] =~ "\.php$" {
2734+ setenv.add-response-header = ( "Content-Encoding" => "gzip")
2735+ }
2736+
2737+
2738+TurboGears
2739+----------
2740+
2741+To compress dynamic content with TurboGears please enable ::
2742+
2743+ [/]
2744+ gzip_filter.on = True
2745+ gzip_filter.mime_types = ["application/x-javascript", "text/javascript", "text/html", "text/css", "text/plain"]
2746+
2747+in the config/app.cfg file in your TurboGears application. The above lines should already be in the file. You just need to remove the comment symbol in front of the lines to make them active.
2748+
2749+Django
2750+------
2751+
2752+To compress dynamic content with Django please enable the GZipMiddleware ::
2753+
2754+ MIDDLEWARE_CLASSES = (
2755+ 'django.middleware.gzip.GZipMiddleware',
2756+ ...
2757+ )
2758+
2759+in the settings.py file in your Django project.
2760+
2761+Catalyst
2762+--------
2763+
2764+To compress dynamic content with Perl/Catalyst, simply use the Catalyst::Plugin::Compress::Gzip module available on CPAN ::
2765+
2766+ use Catalyst qw(
2767+ Compress::Gzip
2768+ ...
2769+ );
2770+
2771+in your main package (MyApp.pm). Further configuration is not required.
2772+
2773+}}}
2774+
2775+
2776+
170f212a
ER
2777Index: doc/rewrite.txt
2778===================================================================
738baab9
ER
2779--- doc/rewrite.txt (.../tags/lighttpd-1.4.20) (revision 2389)
2780+++ doc/rewrite.txt (.../branches/lighttpd-1.4.x) (revision 2389)
170f212a
ER
2781@@ -43,6 +43,12 @@
2782 The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once``
2783 in 1.3.16.
2784
2785+Warning
2786+=======
2787+
2788+Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client
2789+is matched against your rules, for example strings like "/abc/../xyz%2f/path".
2790+
2791 Examples
2792 ========
2793
1e1cc0d1
ER
2794Index: SConstruct
2795===================================================================
738baab9
ER
2796--- SConstruct (.../tags/lighttpd-1.4.20) (revision 2389)
2797+++ SConstruct (.../branches/lighttpd-1.4.x) (revision 2389)
49b4da39
ER
2798@@ -5,7 +5,7 @@
2799 from stat import *
2800
2801 package = 'lighttpd'
709c1a0b
ER
2802-version = '1.4.20'
2803+version = '1.4.21'
10dbb8f0 2804
49b4da39
ER
2805 def checkCHeaders(autoconf, hdrs):
2806 p = re.compile('[^A-Z0-9]')
ad6a5263
ER
2807Index: Makefile.am
2808===================================================================
738baab9
ER
2809--- Makefile.am (.../tags/lighttpd-1.4.20) (revision 2389)
2810+++ Makefile.am (.../branches/lighttpd-1.4.x) (revision 2389)
709c1a0b
ER
2811@@ -1,4 +1,4 @@
2812-SUBDIRS=src doc tests cygwin openwrt
2813+SUBDIRS=src doc tests
2814
2815 EXTRA_DIST=autogen.sh SConstruct
ad6a5263 2816
cc1350fa
ER
2817Index: NEWS
2818===================================================================
738baab9
ER
2819--- NEWS (.../tags/lighttpd-1.4.20) (revision 2389)
2820+++ NEWS (.../branches/lighttpd-1.4.x) (revision 2389)
2821@@ -3,8 +3,41 @@
cc1350fa
ER
2822 NEWS
2823 ====
2824
709c1a0b
ER
2825-- 1.4.20 -
2826+- 1.4.21 -
2827
2828+ * Fix base64 decoding in mod_auth (#1757, thx guido)
2829+ * Fix mod_cgi segfault when bound to unix domain socket (#653)
2830+ * Do not rely on ioctl FIONREAD (#673)
2831+ * Now really fix mod auth ldap (#1066)
2832+ * Fix leaving zombie process with include_shell (#1777)
2833+ * Removed debian/, openwrt/ and cygwin/; they weren't kept up-to-date, and we decided to remove dist. specific stuff
2834+ * Try to convert string options to shorts for numeric options in config file; allows to use env-vars for numeric options. (#1159, thx andrewb)
2835+ * Do not cache default vhost in mod_simple_vhost (#709)
2836+ * Trust pcre-config, do not check for pcre manually (#1769)
2837+ * Fix fastcgi authorization in subdirectories with check-local=disabled; don't split pathinfo for authorizer. (#963)
2ed0f534
ER
2838+ * Add possibility to disable methods in mod_compress (#1773)
2839+ * Fix duplicate connection keep-alive/transfer-encoding headers (#960)
2840+ * Fixed fix for round-robin in mod_proxy (forgot to increment the index) (#1715)
170f212a
ER
2841+ * Fix fastcgi-authorizer handling; Status: 200 is now accepted as the doc requests
2842+ * Compare address family in inet_ntop_cache
2843+ * Revert CVE-2008-4359 (#1720) fix "encoding+simplifying urls for rewrite/redirect": too many regressions.
2844+ * Use FD_CLOEXEC if possible (fixes #1821)
2845+ * Optimized buffer usage in mod_proxy (fixes #1850)
2846+ * Fix uninitialized value in time struct after strptime
738baab9
ER
2847+ * Do not pass Proxy-Connection: header from client to backend http server in mod_proxy (#1877)
2848+ * Fix wrong malloc sizes in mod_accesslog (probably nothing bad happened...) (fixes #1855, thx ycheng)
2849+ * Some small buffer.c fixes (closes #1837)
2850+ * Remove floating point math from server.c (fixes #1402)
2851+ * Disable SSLv2 by default
2852+ * Use/enforce sane max-connection values (fixes #1803)
2853+ * Allow mod_compress to return 304 (Not Modified); compress ignores the static-file.etags option.(fixes #1884)
2854+ * Add option to ignore the "Expect: 100-continue" header instead of returning 417 Expectation failed (closes #1017)
2855+ * Use modified etags in mod_compress (fixes #1800)
2856+ * Fix max-connection limit handling/100% cpu usage (fixes #1436)
2857+ * Fix error handling in freebsd-sendfile (fixes #1813)
709c1a0b
ER
2858+
2859+- 1.4.20 - 2008-09-30
2860+
2861 * Fix mod_compress to compile with old gcc version (#1592)
2862 * Fix mod_extforward to compile with old gcc version (#1591)
2863 * Update documentation for #1587
738baab9 2864@@ -49,10 +82,10 @@
170f212a
ER
2865 * allow digits in [s]cgi env vars (#1712)
2866 * fixed dropping last character of evhost pattern (#161)
2867 * print helpful error message on conditionals in global block (#1550)
2868- * decode url before matching in mod_rewrite (#1720)
2869+ * decode url before matching in mod_rewrite (#1720) -- (reverted for 1.4.21)
2ed0f534 2870 * fixed conditional patching of ldap filter (#1564)
170f212a 2871- * Match headers case insensitive in response (removing of X-{Sendfile,LIGHTTPD-*}, catching Date/Server)
2ed0f534 2872- * fixed bug with case-insensitive filenames in mod_userdir (#1589), spotted by "anders1"
170f212a 2873+ * Match headers case insensitive in response (removing of X-{Sendfile,LIGHTTPD-*}, catching Date/Server) [2281]
2ed0f534
ER
2874+ * fixed bug with case-insensitive filenames in mod_userdir (#1589), spotted by "anders1" (CVE-2008-4360)
2875 * fixed format string bugs in mod_accesslog for SYSLOG
2876 * replaced fprintf with log_error_write in fastcgi debug
2877 * fixed mem leak in ssi expression parser (#1753), thx Take5k
738baab9 2878@@ -62,9 +95,9 @@
2ed0f534
ER
2879 * fix splitting of auth-ldap filter
2880 * workaround ldap connection leak if a ldap connection failed (restarting ldap)
2881 * fix auth.backend.ldap.bind-dn/pw problems (only read from global context for temporary ldap reconnects, thx ruskie)
2882- * fix memleak in request header parsing (#1774, thx qhy)
2883+ * fix memleak in request header parsing (#1774, thx qhy) (CVE-2008-4298)
2884 * fix mod_rewrite memleak/endless loop detection (#1775, thx phy - again!)
2885- * use decoded url for matching in mod_redirect (#1720)
170f212a 2886+ * use decoded url for matching in mod_redirect (#1720) (CVE-2008-4359) -- (reverted for 1.4.21)
2ed0f534
ER
2887
2888 - 1.4.19 - 2008-03-10
2889
170f212a
ER
2890Index: CMakeLists.txt
2891===================================================================
2892--- CMakeLists.txt (.../tags/lighttpd-1.4.20) (revision 0)
738baab9
ER
2893+++ CMakeLists.txt (.../branches/lighttpd-1.4.x) (revision 2389)
2894@@ -0,0 +1,27 @@
170f212a
ER
2895+PROJECT(lighttpd C)
2896+
2897+CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
2898+
2899+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
2900+
2901+INCLUDE(CTest)
2902+
2903+ENABLE_TESTING()
2904+
738baab9
ER
2905+SET(CPACK_PACKAGE_VERSION_MAJOR 1)
2906+SET(CPACK_PACKAGE_VERSION_MINOR 4)
2907+SET(CPACK_PACKAGE_VERSION_PATCH 21)
2908+SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
170f212a
ER
2909+
2910+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
2911+SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
2912+SET(CPACK_PACKAGE_VENDOR "jan@kneschke.de")
2913+
2914+SET(CPACK_SOURCE_GENERATOR "TGZ")
2915+SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.;~$;/_;build/;CMakeFiles/;CMakeCache;gz$;Makefile\\\\.;trace;Testing/;foo;autom4te;cmake_install;CPack;\\\\.pem;ltmain.sh;configure;libtool;/config\\\\.;missing;autogen.sh;install-sh;Dart;aclocal;log$;Makefile$")
2916+
2917+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
2918+
2919+ADD_SUBDIRECTORY(src build)
2920+#ADD_SUBDIRECTORY(doc)
2921+ADD_SUBDIRECTORY(tests)
a34aaa25
ER
2922
2923Property changes on: .
2924___________________________________________________________________
709c1a0b
ER
2925Modified: bzr:revision-info
2926 - timestamp: 2008-09-23 21:04:22.819999933 +0200
54b68997
ER
2927committer: Stefan Bühler <stbuehler@web.de>
2928properties:
2929 branch-nick: lighttpd-1.4.x
2930
738baab9 2931 + timestamp: 2009-02-05 12:44:42.130000114 +0100
709c1a0b
ER
2932committer: Stefan Bühler <stbuehler@web.de>
2933properties:
2934 branch-nick: lighttpd-1.4.x
2935
2936Modified: bzr:revision-id:v3-trunk0
2937 - 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
29381128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
29391129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
29401130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
29411131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
29421132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
29431133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
29441134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
29451135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
29461136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
29471137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
29481138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
29491139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
29501140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
29511141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
29521142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
29531143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
29541144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
29551145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
29561146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
29571147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
29581148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
29591149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
29601150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
29611151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
29621152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
29631153 stbuehler@web.de-20080812194728-fupt781o6q058unh
29641154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
29651155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
29661156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
29671157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
29681158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
29691159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
29701160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
29711161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
29721162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
29731163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
29741164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
29751165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
29761166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
29771167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
29781168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
29791169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
29801170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
29811171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
29821172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
29831173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
29841174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
29851175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
2986
54b68997
ER
2987 + 1127 stbuehler@web.de-20080728081644-j4cxnhduw8kbt8um
29881128 stbuehler@web.de-20080728084246-axvxdtjsrratxixs
29891129 stbuehler@web.de-20080729211700-s8v6nq2cu06qesls
29901130 stbuehler@web.de-20080729211726-4yxb6e5dva1cn0lz
29911131 stbuehler@web.de-20080729211750-4ulzigswx17uciyu
29921132 stbuehler@web.de-20080729211850-nliz3kd0m576ztuu
29931133 stbuehler@web.de-20080730163440-dg2y2sbf0u4grmn4
29941134 stbuehler@web.de-20080730173952-kiutzg6geqy7mick
29951135 stbuehler@web.de-20080730193616-9kc2ms7rrhv1lkn7
29961136 stbuehler@web.de-20080730211457-z4a6uth1y29glbqh
29971137 stbuehler@web.de-20080730213517-b6sjcrdwbmipl334
29981138 stbuehler@web.de-20080731102617-2xw8unjfqic7lsew
29991139 stbuehler@web.de-20080731102703-q4tu5a6em9y8xdg0
30001140 stbuehler@web.de-20080731102729-l6vn5b05w9swqbg5
30011141 stbuehler@web.de-20080731102756-oj3d4tnk0l90mj77
30021142 stbuehler@web.de-20080731204442-blw14cj2fkr3l8ly
30031143 stbuehler@web.de-20080731204508-imtfnurf922mg7tj
30041144 stbuehler@web.de-20080801112347-girnwswdkwm8wuip
30051145 stbuehler@web.de-20080801161245-kx1temr529o7xko9
30061146 stbuehler@web.de-20080801175332-oc9e7x8edn1owcc0
30071147 stbuehler@web.de-20080801183454-5i66v0gsdv0cgmia
30081148 stbuehler@web.de-20080801192849-6zklfbb832sx0hvr
30091149 stbuehler@web.de-20080801203119-o16elp8w854s6lol
30101150 stbuehler@web.de-20080802162146-a4v57svc788pwdsv
30111151 stbuehler@web.de-20080802162202-9udlc1wuwt09pyh2
30121152 stbuehler@web.de-20080804135803-yuor9ze06px7qta4
30131153 stbuehler@web.de-20080812194728-fupt781o6q058unh
30141154 stbuehler@web.de-20080818162116-piz0ukqsaecv2li2
30151155 stbuehler@web.de-20080818235700-94t0xc6ml70zojwq
30161156 stbuehler@web.de-20080819163650-1qhwsqszr78cr4xx
30171157 stbuehler@web.de-20080819163757-1qq3t1f1wj69t8xs
30181158 stbuehler@web.de-20080819163914-rklhkurg8apv85l2
30191159 stbuehler@web.de-20080819163953-tlqew751e43phf5b
30201160 stbuehler@web.de-20080819164108-8ogh68sm1uyteawe
30211161 stbuehler@web.de-20080819173911-w5bqpb7cp9jmdqye
30221162 stbuehler@web.de-20080819222242-c0ta5gnli9p3j35a
30231163 stbuehler@web.de-20080820100730-g1bwdh4nqb53ag9u
30241164 stbuehler@web.de-20080820100752-9pggugdyfnnps8qu
30251165 stbuehler@web.de-20080820164258-v2j00motsrsc5esp
30261166 stbuehler@web.de-20080827144628-hi9hf4ch3n1wf9ao
30271167 stbuehler@web.de-20080827144903-tfxu4yehlyu5kegc
30281168 stbuehler@web.de-20080827155155-7mt92orehbxkh2lh
30291169 stbuehler@web.de-20080917142048-zbcwpk39q9ewd516
30301170 stbuehler@web.de-20080917142300-16gzt21x4nbjtj87
709c1a0b
ER
30311171 stbuehler@web.de-20080919160134-385anjnd3txxdw3x
30321172 stbuehler@web.de-20080920134142-fvvwaw2ys51dg4rj
30331173 stbuehler@web.de-20080921153311-1f7rn01atdilmxmy
30341174 stbuehler@web.de-20080922101346-wel327kjmykkpvmp
30351175 stbuehler@web.de-20080923190422-uow06l38ndue36o4
30361176 stbuehler@web.de-20080930112012-53jby2m8xslmd1hm
30371177 stbuehler@web.de-20080930134824-j9q72rwuiczzof5k
30381178 stbuehler@web.de-20080930142037-32pb6m3zjcwryw1w
30391179 stbuehler@web.de-20080930142756-ueovgoshyb996bce
30401180 stbuehler@web.de-20080930152935-1zfy67brol3xdbc0
30411181 stbuehler@web.de-20080930193919-13n2q4c6fbgw0dkx
30421182 stbuehler@web.de-20080930211152-4hmgs95wyg2deol7
30431183 stbuehler@web.de-20081001132402-hxnyu6yzyk3mjf4d
30441184 stbuehler@web.de-20081001155102-qf0mmu2kkpgr7xf0
30451185 stbuehler@web.de-20081001160009-n67ss0vzlac2y60k
30461186 stbuehler@web.de-20081001200802-l5og517etnneitk0
2ed0f534
ER
30471188 stbuehler@web.de-20081004160711-ygaohrecmutiqlla
30481189 stbuehler@web.de-20081004211932-vq16u26mthbeed7d
30491191 stbuehler@web.de-20081005224446-1bztt6zqrjh8w8fd
170f212a
ER
30501192 stbuehler@web.de-20081012114652-ihgz590f0gl5gxpw
30511193 stbuehler@web.de-20081012114716-jnzljhexi4z2gh92
30521195 stbuehler@web.de-20081016120614-kz39vxtz1pebho0o
30531196 stbuehler@web.de-20081016121103-trug4hts0o62d1ut
30541197 stbuehler@web.de-20081016121114-65quosenmso8frf8
30551198 stbuehler@web.de-20081016121421-xjjb7fb53pxu6odj
30561199 stbuehler@web.de-20081205222033-6qok7y19pwp3kxm9
30571200 stbuehler@web.de-20081205222811-49izmzxui0y9ncq6
30581201 stbuehler@web.de-20081205233903-708beaujtf26gprx
30591202 stbuehler@web.de-20081207151631-yv9bdf94zw83jxpv
30601203 stbuehler@web.de-20081207151822-mhyg0gkedmttdqvd
30611204 stbuehler@web.de-20081207151835-1m3yta2fjc4pgb8y
30621205 stbuehler@web.de-20081218221139-w8los43bjbhy9urh
30631206 stbuehler@web.de-20081218222305-5wz7000a62iqa81r
738baab9
ER
30641208 stbuehler@web.de-20090203201352-ivan8lsb3nkv1go5
30651209 stbuehler@web.de-20090203204231-03zjmk7qiol9yxgq
30661210 stbuehler@web.de-20090203210157-bx1e59fqple5oj3v
30671211 stbuehler@web.de-20090203221006-qd6w80m7lmeqgrjh
30681212 stbuehler@web.de-20090203225303-3dwmialad2u720h8
30691213 stbuehler@web.de-20090204102521-jl3vo2ftp5rsbx9y
30701214 stbuehler@web.de-20090204151616-n56of74dydkqdkgh
30711215 stbuehler@web.de-20090204172956-6wzsv0nm5nxcgfym
30721216 stbuehler@web.de-20090205105134-6i5key9439wspueq
30731217 stbuehler@web.de-20090205114017-0voscqjd5bdm9mwv
30741218 stbuehler@web.de-20090205114442-peekxwpevjl3t7j3
54b68997 3075
a34aaa25 3076
This page took 0.56582 seconds and 4 git commands to generate.