2 ===================================================================
3 --- configure.in (.../tags/lighttpd-1.4.16) (revision 1922)
4 +++ configure.in (.../branches/lighttpd-1.4.x) (revision 1922)
7 # Process this file with autoconf to produce a configure script.
9 -AC_INIT(lighttpd, 1.4.15, jan@kneschke.de)
10 +AC_INIT(lighttpd, 1.4.17, jan@kneschke.de)
11 AC_CONFIG_SRCDIR([src/server.c])
14 Index: src/connections.c
15 ===================================================================
16 --- src/connections.c (.../tags/lighttpd-1.4.16) (revision 1922)
17 +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1922)
18 @@ -1412,42 +1412,42 @@
20 switch (r = http_response_prepare(srv, con)) {
21 case HANDLER_FINISHED:
22 - if (con->http_status == 404 ||
23 - con->http_status == 403) {
24 - /* 404 error-handler */
25 + if (con->mode == DIRECT) {
26 + if (con->http_status == 404 ||
27 + con->http_status == 403) {
28 + /* 404 error-handler */
30 - if (con->in_error_handler == 0 &&
31 - (!buffer_is_empty(con->conf.error_handler) ||
32 - !buffer_is_empty(con->error_handler))) {
33 - /* call error-handler */
34 + if (con->in_error_handler == 0 &&
35 + (!buffer_is_empty(con->conf.error_handler) ||
36 + !buffer_is_empty(con->error_handler))) {
37 + /* call error-handler */
39 - con->error_handler_saved_status = con->http_status;
40 - con->http_status = 0;
41 + con->error_handler_saved_status = con->http_status;
42 + con->http_status = 0;
44 - if (buffer_is_empty(con->error_handler)) {
45 - buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
47 - buffer_copy_string_buffer(con->request.uri, con->error_handler);
49 - buffer_reset(con->physical.path);
50 + if (buffer_is_empty(con->error_handler)) {
51 + buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
53 + buffer_copy_string_buffer(con->request.uri, con->error_handler);
55 + buffer_reset(con->physical.path);
57 - con->in_error_handler = 1;
58 + con->in_error_handler = 1;
60 - connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
61 + connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
67 + } else if (con->in_error_handler) {
68 + /* error-handler is a 404 */
70 + con->http_status = con->error_handler_saved_status;
72 } else if (con->in_error_handler) {
73 - /* error-handler is a 404 */
75 - con->http_status = con->error_handler_saved_status;
76 + /* error-handler is back and has generated content */
77 + /* if Status: was set, take it otherwise use 200 */
79 - } else if (con->in_error_handler) {
80 - /* error-handler is back and has generated content */
81 - /* if Status: was set, take it otherwise use 200 */
82 - con->http_status = con->error_handler_saved_status;
85 if (con->http_status == 0) con->http_status = 200;
87 /* we have something to send, go on */
88 Index: src/mod_staticfile.c
89 ===================================================================
90 --- src/mod_staticfile.c (.../tags/lighttpd-1.4.16) (revision 1922)
91 +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 1922)
94 http_chunk_append_file(srv, con, con->physical.path, 0, sce->st.st_size);
96 + con->http_status = 200;
97 con->file_finished = 1;
99 return HANDLER_FINISHED;
101 ===================================================================
102 --- src/etag.c (.../tags/lighttpd-1.4.16) (revision 1922)
103 +++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 1922)
113 int etag_mutate(buffer *mut, buffer *etag) {
118 for (h=0, i=0; i < etag->used; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]);
120 Index: src/mod_mysql_vhost.c
121 ===================================================================
122 --- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.16) (revision 1922)
123 +++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 1922)
126 return HANDLER_ERROR;
129 + /* in mysql versions above 5.0.3 the reconnect flag is off by default */
130 + my_bool reconnect = 1;
131 + mysql_options(s->mysql, MYSQL_OPT_RECONNECT, &reconnect);
133 #define FOO(x) (s->x->used ? s->x->ptr : NULL)
135 if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
136 Index: src/mod_compress.c
137 ===================================================================
138 --- src/mod_compress.c (.../tags/lighttpd-1.4.16) (revision 1922)
139 +++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 1922)
141 /* don't compress files that are too large as we need to much time to handle them */
142 if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return HANDLER_GO_ON;
144 + /* don't try to compress files less than 128 bytes
146 + * - extra overhead for compression
147 + * - mmap() fails for st_size = 0 :)
149 + if (sce->st.st_size < 128) return HANDLER_GO_ON;
151 /* check if mimetype is in compress-config */
152 for (m = 0; m < p->conf.compress->used; m++) {
153 data_string *compress_ds = (data_string *)p->conf.compress->data[m];
154 Index: src/mod_dirlisting.c
155 ===================================================================
156 --- src/mod_dirlisting.c (.../tags/lighttpd-1.4.16) (revision 1922)
157 +++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 1922)
160 buffer *external_css;
162 + buffer *set_footer;
167 excludes_buffer_free(s->excludes);
168 buffer_free(s->external_css);
169 buffer_free(s->encoding);
170 + buffer_free(s->set_footer);
175 #define CONFIG_SHOW_HEADER "dir-listing.show-header"
176 #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
177 #define CONFIG_DIR_LISTING "server.dir-listing"
178 +#define CONFIG_SET_FOOTER "dir-listing.set-footer"
181 SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
182 plugin_data *p = p_d;
185 { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
186 { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
187 { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
188 + { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
190 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
194 s->hide_header_file = 0;
195 s->encoding = buffer_init();
196 + s->set_footer = buffer_init();
198 cv[0].destination = s->excludes;
199 cv[1].destination = &(s->dir_listing);
201 cv[7].destination = &(s->show_header);
202 cv[8].destination = &(s->hide_header_file);
203 cv[9].destination = &(s->dir_listing); /* old name */
204 + cv[10].destination = s->set_footer;
206 p->config_storage[i] = s;
207 ca = ((data_config *)srv->config_context->data[i])->value;
210 PATCH(hide_header_file);
214 /* skip the first, the global context */
215 for (i = 1; i < srv->config_context->used; i++) {
218 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) {
219 PATCH(hide_header_file);
220 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) {
222 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
226 "h2 {margin-bottom: 12px;}\n"
227 "table {margin-left: 12px;}\n"
229 - " font-family: \"Courier New\", Courier, monospace;"
230 - " font-size: 10pt;"
231 + " font: 90% monospace;"
236 " padding-bottom: 14px;"
239 - " font-family: \"Courier New\", Courier, monospace;"
240 - " font-size: 10pt;"
241 + " font: 90% monospace;"
246 "<div class=\"foot\">"
249 - if (buffer_is_empty(con->conf.server_tag)) {
250 + if (p->conf.set_footer->used > 1) {
251 + buffer_append_string_buffer(out, p->conf.set_footer);
252 + } else if (buffer_is_empty(con->conf.server_tag)) {
253 BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION);
255 buffer_append_string_buffer(out, con->conf.server_tag);
256 Index: tests/404-handler.conf
257 ===================================================================
258 --- tests/404-handler.conf (.../tags/lighttpd-1.4.16) (revision 0)
259 +++ tests/404-handler.conf (.../branches/lighttpd-1.4.x) (revision 1922)
261 +debug.log-request-handling = "enable"
262 +debug.log-response-header = "enable"
263 +debug.log-request-header = "enable"
265 +server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
266 +server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
268 +## bind to port (default: 80)
271 +## bind to localhost (default: all interfaces)
272 +server.bind = "localhost"
273 +server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
274 +server.name = "www.example.org"
275 +server.tag = "Apache 1.3.29"
283 +######################## MODULE CONFIG ############################
286 +accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log"
288 +mimetype.assign = ( ".html" => "text/html" )
290 +cgi.assign = (".pl" => "/usr/bin/perl" )
292 +# fastcgi.server += ( "/404.pl" =>
293 +# ( "404-handler" =>
295 +# "socket" => env.SRCDIR + "/tmp/pl-404-fastcgi-1.socket",
296 +# "bin-path" => server.document-root + "/404.pl",
298 +# "check-local" => "disable",
299 +# "broken-scriptfilename" => "enable",
304 +$HTTP["url"] =~ "^/static/" {
305 + server.error-handler-404 = "/404.html"
307 +else $HTTP["url"] =~ "." {
308 + server.error-handler-404 = "/404.pl"
310 Index: tests/mod-cgi.t
311 ===================================================================
312 --- tests/mod-cgi.t (.../tags/lighttpd-1.4.16) (revision 1922)
313 +++ tests/mod-cgi.t (.../branches/lighttpd-1.4.x) (revision 1922)
318 -use Test::More tests => 15;
319 +use Test::More tests => 16;
322 my $tf = LightyTest->new();
325 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ];
326 ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
327 +# broken header crash
328 +$t->{REQUEST} = ( <<EOF
329 +GET /crlfcrash.pl HTTP/1.0
332 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 500 } ];
333 +ok($tf->handle_http($t) == 0, 'broken header via perl cgi');
335 ok($tf->stop_proc == 0, "Stopping lighttpd");
337 Index: tests/docroot/www/crlfcrash.pl
338 ===================================================================
339 --- tests/docroot/www/crlfcrash.pl (.../tags/lighttpd-1.4.16) (revision 0)
340 +++ tests/docroot/www/crlfcrash.pl (.../branches/lighttpd-1.4.x) (revision 1922)
344 +print "Location: http://www.example.org/\r\n\n\n";
346 Index: tests/docroot/www/404.pl
347 ===================================================================
348 --- tests/docroot/www/404.pl (.../tags/lighttpd-1.4.16) (revision 0)
349 +++ tests/docroot/www/404.pl (.../branches/lighttpd-1.4.x) (revision 1922)
352 +use CGI qw/:standard/;
354 +my $request_uri = $ENV{'REQUEST_URI'};
355 +print (STDERR "REQUEST_URI: $request_uri\n");
357 +if ($request_uri =~ m/^\/dynamic\/200\// ) {
358 + print header ( -status => 200,
359 + -type => 'text/plain' );
360 + print ("found here\n");
362 +elsif ($request_uri =~ m|^/dynamic/302/| ) {
363 + print header( -status=>302,
364 + -location => 'http://www.example.org/');
366 +elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
367 + print header ( -status => 404
368 + -type => 'text/plain' );
369 + print ("Not found here\n");
371 +elsif ($request_uri =~ m/^\/send404\.pl/ ) {
372 + print header ( -status => 404
373 + -type => 'text/plain' );
374 + print ("Not found here (send404)\n");
376 +elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) {
377 + print ("found here\n");
380 + print header ( -status => 500,
381 + -type => 'text/plain');
385 Property changes on: tests/docroot/www/404.pl
386 ___________________________________________________________________
390 Index: tests/docroot/www/send404.pl
391 ===================================================================
392 --- tests/docroot/www/send404.pl (.../tags/lighttpd-1.4.16) (revision 0)
393 +++ tests/docroot/www/send404.pl (.../branches/lighttpd-1.4.x) (revision 1922)
396 +use CGI qw/:standard/;
397 +print header ( -status => 404
398 + -type => 'text/plain' );
399 +print ("send404\n");
401 Property changes on: tests/docroot/www/send404.pl
402 ___________________________________________________________________
406 Index: tests/docroot/www/404.html
407 ===================================================================
408 --- tests/docroot/www/404.html (.../tags/lighttpd-1.4.16) (revision 0)
409 +++ tests/docroot/www/404.html (.../branches/lighttpd-1.4.x) (revision 1922)
412 Index: tests/docroot/www/404.fcgi
413 ===================================================================
414 --- tests/docroot/www/404.fcgi (.../tags/lighttpd-1.4.16) (revision 0)
415 +++ tests/docroot/www/404.fcgi (.../branches/lighttpd-1.4.x) (revision 1922)
418 +#use CGI qw/:standard/;
419 +use CGI::Fast qw(:standard);
421 +while (new CGI::Fast) {
422 + my $request_uri = $ENV{'REQUEST_URI'};
423 + print (STDERR "REQUEST_URI: $request_uri\n");
424 + if ($request_uri =~ m/^\/dynamic\/200\// ) {
425 + print header ( -status => 200,
426 + -type => 'text/plain' );
427 + print ("found here\n");
429 + elsif ($request_uri =~ m|^/dynamic/302/| ) {
430 + print header( -status=>302,
431 + -location => 'http://www.example.org/');
433 + elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
434 + print header ( -status => 404
435 + -type => 'text/plain' );
436 + print ("Not found here\n");
439 + print header ( -status => 500,
440 + -type => 'text/plain');
445 Property changes on: tests/docroot/www/404.fcgi
446 ___________________________________________________________________
450 Index: tests/core-404-handler.t
451 ===================================================================
452 --- tests/core-404-handler.t (.../tags/lighttpd-1.4.16) (revision 0)
453 +++ tests/core-404-handler.t (.../branches/lighttpd-1.4.x) (revision 1922)
457 +# combinations we have to test:
459 +# 404-handler -> static file (verify content)
460 +# 404-handler -> fastcgi
462 +# returning 302 + Location
464 +# returning no status -> 200
467 + # add current source dir to the include-path
468 + # we need this for make distcheck
469 + (my $srcdir = $0) =~ s#/[^/]+$#/#;
470 + unshift @INC, $srcdir;
475 +use Test::More tests => 8;
478 +my $tf = LightyTest->new();
480 +$tf->{CONFIGFILE} = '404-handler.conf';
482 +ok($tf->start_proc == 0, "Starting lighttpd") or die();
484 +$t->{REQUEST} = ( <<EOF
485 +GET /static/notfound HTTP/1.0
488 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "static not found\n" } ];
489 +ok($tf->handle_http($t) == 0, '404 handler => static');
494 +$t->{REQUEST} = ( <<EOF
495 +GET /dynamic/200/notfound HTTP/1.0
498 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
499 +ok($tf->handle_http($t) == 0, '404 handler => dynamic(200)');
501 +$t->{REQUEST} = ( <<EOF
502 +GET /dynamic/302/notfound HTTP/1.0
505 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => "http://www.example.org/" } ];
506 +ok($tf->handle_http($t) == 0, '404 handler => dynamic(302)');
508 +$t->{REQUEST} = ( <<EOF
509 +GET /dynamic/404/notfound HTTP/1.0
512 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "Not found here\n" } ];
513 +ok($tf->handle_http($t) == 0, '404 handler => dynamic(404)');
515 +$t->{REQUEST} = ( <<EOF
516 +GET /dynamic/nostatus/notfound HTTP/1.0
519 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
520 +ok($tf->handle_http($t) == 0, '404 handler => dynamic(nostatus)');
522 +$t->{REQUEST} = ( <<EOF
523 +GET /send404.pl HTTP/1.0
526 +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "send404\n" } ];
527 +ok($tf->handle_http($t) == 0, '404 generated by CGI should stay 404');
529 +ok($tf->stop_proc == 0, "Stopping lighttpd");
531 Index: doc/lighttpd.conf
532 ===================================================================
533 --- doc/lighttpd.conf (.../tags/lighttpd-1.4.16) (revision 1922)
534 +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 1922)
537 ## a static document-root, for virtual-hosting take look at the
538 ## server.virtual-* options
539 -server.document-root = "/www/pages/"
540 +server.document-root = "/srv/www/htdocs/"
542 ## where to send error-messages to
543 -server.errorlog = "/www/logs/lighttpd.error.log"
544 +server.errorlog = "/var/log/lighttpd/error.log"
546 # files to check for if .../ is requested
547 index-file.names = ( "index.php", "index.html",
549 ".wmv" => "video/x-ms-wmv",
550 ".bz2" => "application/x-bzip",
551 ".tbz" => "application/x-bzip-compressed-tar",
552 - ".tar.bz2" => "application/x-bzip-compressed-tar"
553 + ".tar.bz2" => "application/x-bzip-compressed-tar",
554 + # default mime type
555 + "" => "application/octet-stream",
558 # Use the "Content-Type" extended attribute to obtain mime type if possible
560 # server.tag = "lighttpd"
562 #### accesslog module
563 -accesslog.filename = "/www/logs/access.log"
564 +accesslog.filename = "/var/log/lighttpd/access.log"
566 ## deny access the file-extensions
571 ## bind to localhost (default: all interfaces)
572 -#server.bind = "grisu.home.kneschke.de"
573 +#server.bind = "127.0.0.1"
575 ## error-handler for status 404
576 #server.error-handler-404 = "/error-handler.html"
577 @@ -158,15 +160,16 @@
579 ## virtual-server-root + http-host + virtual-server-docroot
581 -#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
582 -#simple-vhost.default-host = "grisu.home.kneschke.de"
583 -#simple-vhost.document-root = "/pages/"
584 +#simple-vhost.server-root = "/srv/www/vhosts/"
585 +#simple-vhost.default-host = "www.example.org"
586 +#simple-vhost.document-root = "/htdocs/"
590 ## Format: <errorfile-prefix><status-code>.html
591 ## -> ..../status-404.html for 'File not found'
592 -#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-"
593 +#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
594 +#server.errorfile-prefix = "/srv/www/errors/status-"
596 ## virtual directory listings
597 #dir-listing.activate = "enable"
599 #server.groupname = "wwwrun"
602 -#compress.cache-dir = "/tmp/lighttpd/cache/compress/"
603 +#compress.cache-dir = "/var/cache/lighttpd/compress/"
604 #compress.filetype = ("text/plain", "text/html")
608 #fastcgi.server = ( ".php" =>
611 -# "socket" => "/tmp/php-fastcgi.socket",
612 -# "bin-path" => "/usr/local/bin/php"
613 +# "socket" => "/var/run/lighttpd/php-fastcgi.socket",
614 +# "bin-path" => "/usr/local/bin/php-cgi"
621 #ssl.engine = "enable"
622 -#ssl.pemfile = "server.pem"
623 +#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
626 #status.status-url = "/server-status"
628 # %3 => subdomain 1 name
629 # %4 => subdomain 2 name
631 -#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
632 +#evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/"
635 #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
636 @@ -279,14 +282,14 @@
639 #rrdtool.binary = "/usr/bin/rrdtool"
640 -#rrdtool.db-name = "/var/www/lighttpd.rrd"
641 +#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
644 #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
645 #setenv.add-response-header = ( "X-Secret-Message" => "42" )
647 ## for mod_trigger_b4_dl
648 -# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
649 +# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
650 # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
651 # trigger-before-download.trigger-url = "^/trigger/"
652 # trigger-before-download.download-url = "^/download/"
654 ===================================================================
655 --- NEWS (.../tags/lighttpd-1.4.16) (revision 1922)
656 +++ NEWS (.../branches/lighttpd-1.4.x) (revision 1922)
662 + * added dir-listing.set-footer in mod_dirlisting (#1277)
663 + * fixed hardcoded font-sizes in mod_dirlisting (#1267)
664 + * fixed different ETag length on 32/64 platforms (#1279)
665 + * fixed compression of files < 128 bytes by disabling compression (#1241)
666 + * fixed mysql server reconnects (#518)
670 * added static-file.etags, etag.use-inode, etag.use-mtime, etag.use-size