+# Revision 2724
Index: src/connections.c
===================================================================
---- src/connections.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -1412,42 +1412,42 @@
-
- switch (r = http_response_prepare(srv, con)) {
- case HANDLER_FINISHED:
-- if (con->http_status == 404 ||
-- con->http_status == 403) {
-- /* 404 error-handler */
-+ if (con->mode == DIRECT) {
-+ if (con->http_status == 404 ||
-+ con->http_status == 403) {
-+ /* 404 error-handler */
-
-- if (con->in_error_handler == 0 &&
-- (!buffer_is_empty(con->conf.error_handler) ||
-- !buffer_is_empty(con->error_handler))) {
-- /* call error-handler */
-+ if (con->in_error_handler == 0 &&
-+ (!buffer_is_empty(con->conf.error_handler) ||
-+ !buffer_is_empty(con->error_handler))) {
-+ /* call error-handler */
-
-- con->error_handler_saved_status = con->http_status;
-- con->http_status = 0;
-+ con->error_handler_saved_status = con->http_status;
-+ con->http_status = 0;
-
-- if (buffer_is_empty(con->error_handler)) {
-- buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
-- } else {
-- buffer_copy_string_buffer(con->request.uri, con->error_handler);
-- }
-- buffer_reset(con->physical.path);
-+ if (buffer_is_empty(con->error_handler)) {
-+ buffer_copy_string_buffer(con->request.uri, con->conf.error_handler);
-+ } else {
-+ buffer_copy_string_buffer(con->request.uri, con->error_handler);
-+ }
-+ buffer_reset(con->physical.path);
-
-- con->in_error_handler = 1;
-+ con->in_error_handler = 1;
-
-- connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
-+ connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
-
-- done = -1;
-- break;
-+ done = -1;
-+ break;
-+ } else if (con->in_error_handler) {
-+ /* error-handler is a 404 */
-+
-+ con->http_status = con->error_handler_saved_status;
-+ }
- } else if (con->in_error_handler) {
-- /* error-handler is a 404 */
--
-- con->http_status = con->error_handler_saved_status;
-+ /* error-handler is back and has generated content */
-+ /* if Status: was set, take it otherwise use 200 */
- }
-- } else if (con->in_error_handler) {
-- /* error-handler is back and has generated content */
-- /* if Status: was set, take it otherwise use 200 */
-- con->http_status = con->error_handler_saved_status;
- }
--
- if (con->http_status == 0) con->http_status = 200;
-
- /* we have something to send, go on */
-Index: src/mod_staticfile.c
-===================================================================
---- src/mod_staticfile.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -506,6 +506,7 @@
- */
- http_chunk_append_file(srv, con, con->physical.path, 0, sce->st.st_size);
-
-+ con->http_status = 200;
- con->file_finished = 1;
-
- return HANDLER_FINISHED;
-Index: src/etag.c
-===================================================================
---- src/etag.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -1,4 +1,5 @@
- #include <string.h>
-+#include <stdint.h>
-
- #include "buffer.h"
- #include "etag.h"
-@@ -31,7 +32,8 @@
+--- src/connections.c (.../tags/lighttpd-1.4.26)
++++ src/connections.c (.../branches/lighttpd-1.4.x)
+@@ -82,6 +82,11 @@
+
+ if (-1 == con->ndx) return -1;
+
++ buffer_reset(con->uri.authority);
++ buffer_reset(con->uri.path);
++ buffer_reset(con->uri.query);
++ buffer_reset(con->request.orig_uri);
++
+ i = con->ndx;
+
+ /* not last element */
+Index: src/network.c
+===================================================================
+--- src/network.c (.../tags/lighttpd-1.4.26)
++++ src/network.c (.../branches/lighttpd-1.4.x)
+@@ -82,6 +82,9 @@
+ buffer_copy_string(con->tlsext_server_name, servername);
+ buffer_to_lower(con->tlsext_server_name);
+
++ /* Sometimes this is still set, confusing COMP_HTTP_HOST */
++ buffer_reset(con->uri.authority);
++
+ config_cond_cache_reset(srv, con);
+ config_setup_connection(srv, con);
+
+@@ -525,7 +528,7 @@
+
+ if (!s->ssl_use_sslv2) {
+ /* disable SSLv2 */
+- if (SSL_OP_NO_SSLv2 != SSL_CTX_set_options(s->ssl_ctx, SSL_OP_NO_SSLv2)) {
++ if (!(SSL_OP_NO_SSLv2 & SSL_CTX_set_options(s->ssl_ctx, SSL_OP_NO_SSLv2))) {
+ log_error_write(srv, __FILE__, __LINE__, "ss", "SSL:",
+ ERR_error_string(ERR_get_error(), NULL));
+ return -1;
+Index: src/response.c
+===================================================================
+--- src/response.c (.../tags/lighttpd-1.4.26)
++++ src/response.c (.../branches/lighttpd-1.4.x)
+@@ -136,6 +136,8 @@
+ X509 *xs;
+ X509_NAME *xn;
+ X509_NAME_ENTRY *xe;
++ int i, nentries;
++
+ if (
+ SSL_get_verify_result(con->ssl) != X509_V_OK
+ || !(xs = SSL_get_peer_certificate(con->ssl))
+@@ -144,7 +146,7 @@
+ }
+
+ xn = X509_get_subject_name(xs);
+- for (int i = 0, nentries = X509_NAME_entry_count(xn); i < nentries; ++i) {
++ for (i = 0, nentries = X509_NAME_entry_count(xn); i < nentries; ++i) {
+ int xobjnid;
+ const char * xobjsn;
+ data_string *envds;
+@@ -581,7 +583,7 @@
+ };
+ #endif
+ if (S_ISDIR(sce->st.st_mode)) {
+- if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
++ if (con->uri.path->ptr[con->uri.path->used - 2] != '/') {
+ /* redirect to .../ */
+
+ http_response_redirect_to_directory(srv, con);
+Index: src/mod_proxy.c
+===================================================================
+--- src/mod_proxy.c (.../tags/lighttpd-1.4.26)
++++ src/mod_proxy.c (.../branches/lighttpd-1.4.x)
+@@ -349,6 +349,10 @@
+ srv->cur_fds--;
+ }
+
++ if (hctx->host) {
++ hctx->host->usage--;
++ }
++
+ handler_ctx_free(hctx);
+ con->plugin_ctx[p->id] = NULL;
}
+@@ -848,11 +852,11 @@
+ if (-1 == ret) { /* error on our side */
+ log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed:", strerror(errno), errno);
- int etag_mutate(buffer *mut, buffer *etag) {
-- size_t h, i;
-+ size_t i;
-+ uint32_t h;
-
- for (h=0, i=0; i < etag->used; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]);
-
-Index: src/mod_mysql_vhost.c
-===================================================================
---- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -252,6 +252,11 @@
-
- return HANDLER_ERROR;
- }
-+
-+ /* in mysql versions above 5.0.3 the reconnect flag is off by default */
-+ my_bool reconnect = 1;
-+ mysql_options(s->mysql, MYSQL_OPT_RECONNECT, &reconnect);
-+
- #define FOO(x) (s->x->used ? s->x->ptr : NULL)
-
- if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass),
-Index: src/mod_compress.c
-===================================================================
---- src/mod_compress.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -589,6 +589,13 @@
- /* don't compress files that are too large as we need to much time to handle them */
- if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return HANDLER_GO_ON;
-
-+ /* don't try to compress files less than 128 bytes
-+ *
-+ * - extra overhead for compression
-+ * - mmap() fails for st_size = 0 :)
-+ */
-+ if (sce->st.st_size < 128) return HANDLER_GO_ON;
-+
- /* check if mimetype is in compress-config */
- for (m = 0; m < p->conf.compress->used; m++) {
- data_string *compress_ds = (data_string *)p->conf.compress->data[m];
-Index: src/mod_dirlisting.c
-===================================================================
---- src/mod_dirlisting.c (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -59,6 +59,7 @@
-
- buffer *external_css;
- buffer *encoding;
-+ buffer *set_footer;
- } plugin_config;
-
- typedef struct {
-@@ -173,6 +174,7 @@
- excludes_buffer_free(s->excludes);
- buffer_free(s->external_css);
- buffer_free(s->encoding);
-+ buffer_free(s->set_footer);
+- return HANDLER_WAIT_FOR_EVENT;
++ return HANDLER_ERROR;
+ } else if (-2 == ret) { /* remote close */
+ log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed, remote connection close:", strerror(errno), errno);
- free(s);
+- return HANDLER_WAIT_FOR_EVENT;
++ return HANDLER_ERROR;
}
-@@ -240,7 +242,9 @@
- #define CONFIG_SHOW_HEADER "dir-listing.show-header"
- #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file"
- #define CONFIG_DIR_LISTING "server.dir-listing"
-+#define CONFIG_SET_FOOTER "dir-listing.set-footer"
-+
- SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
- plugin_data *p = p_d;
- size_t i = 0;
-@@ -256,6 +260,7 @@
- { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
- { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
- { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
-+ { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
-
- { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
- };
-@@ -278,6 +283,7 @@
- s->show_header = 0;
- s->hide_header_file = 0;
- s->encoding = buffer_init();
-+ s->set_footer = buffer_init();
-
- cv[0].destination = s->excludes;
- cv[1].destination = &(s->dir_listing);
-@@ -289,6 +295,7 @@
- cv[7].destination = &(s->show_header);
- cv[8].destination = &(s->hide_header_file);
- cv[9].destination = &(s->dir_listing); /* old name */
-+ cv[10].destination = s->set_footer;
-
- p->config_storage[i] = s;
- ca = ((data_config *)srv->config_context->data[i])->value;
-@@ -318,6 +325,7 @@
- PATCH(show_header);
- PATCH(hide_header_file);
- PATCH(excludes);
-+ PATCH(set_footer);
+ if (hctx->wb->bytes_out == hctx->wb->bytes_in) {
+@@ -989,8 +993,6 @@
+ case 0:
+ break;
+ case 1:
+- hctx->host->usage--;
+-
+ /* we are done */
+ proxy_connection_close(srv, hctx);
- /* skip the first, the global context */
- for (i = 1; i < srv->config_context->used; i++) {
-@@ -348,6 +356,8 @@
- PATCH(show_header);
- } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) {
- PATCH(hide_header_file);
-+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) {
-+ PATCH(set_footer);
- } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) {
- PATCH(excludes);
- }
-@@ -467,8 +477,7 @@
- "h2 {margin-bottom: 12px;}\n"
- "table {margin-left: 12px;}\n"
- "th, td {"
-- " font-family: \"Courier New\", Courier, monospace;"
-- " font-size: 10pt;"
-+ " font: 90% monospace;"
- " text-align: left;"
- "}\n"
- "th {"
-@@ -488,8 +497,7 @@
- " padding-bottom: 14px;"
- "}\n"
- "div.foot {"
-- " font-family: \"Courier New\", Courier, monospace;"
-- " font-size: 10pt;"
-+ " font: 90% monospace;"
- " color: #787878;"
- " padding-top: 4px;"
- "}\n"
-@@ -569,7 +577,9 @@
- "<div class=\"foot\">"
- );
+@@ -1077,8 +1079,11 @@
+ return HANDLER_FINISHED;
+ }
-- if (buffer_is_empty(con->conf.server_tag)) {
-+ if (p->conf.set_footer->used > 1) {
-+ buffer_append_string_buffer(out, p->conf.set_footer);
-+ } else if (buffer_is_empty(con->conf.server_tag)) {
- BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION);
- } else {
- buffer_append_string_buffer(out, con->conf.server_tag);
-Index: tests/404-handler.conf
-===================================================================
---- tests/404-handler.conf (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/404-handler.conf (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,49 @@
-+debug.log-request-handling = "enable"
-+debug.log-response-header = "enable"
-+debug.log-request-header = "enable"
-+
-+server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
-+server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
-+
-+## bind to port (default: 80)
-+server.port = 2048
-+
-+## bind to localhost (default: all interfaces)
-+server.bind = "localhost"
-+server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
-+server.name = "www.example.org"
-+server.tag = "Apache 1.3.29"
-+
-+
-+server.modules = (
-+ "mod_fastcgi",
-+ "mod_cgi",
-+ "mod_accesslog" )
-+
-+######################## MODULE CONFIG ############################
-+
-+
-+accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log"
-+
-+mimetype.assign = ( ".html" => "text/html" )
-+
-+cgi.assign = (".pl" => "/usr/bin/perl" )
-+
-+# fastcgi.server += ( "/404.pl" =>
-+# ( "404-handler" =>
-+# (
-+# "socket" => env.SRCDIR + "/tmp/pl-404-fastcgi-1.socket",
-+# "bin-path" => server.document-root + "/404.pl",
-+# "max-procs" => 1,
-+# "check-local" => "disable",
-+# "broken-scriptfilename" => "enable",
-+# )
-+# ),
-+# )
++ if (!con->file_finished) {
++ http_chunk_append_mem(srv, con, NULL, 0);
++ }
+
-+$HTTP["url"] =~ "^/static/" {
-+ server.error-handler-404 = "/404.html"
-+}
-+else $HTTP["url"] =~ "." {
-+ server.error-handler-404 = "/404.pl"
-+}
-Index: tests/mod-cgi.t
+ con->file_finished = 1;
+-
+ proxy_connection_close(srv, hctx);
+ joblist_append(srv, con);
+ } else if (revents & FDEVENT_ERR) {
+@@ -1086,6 +1091,7 @@
+
+ log_error_write(srv, __FILE__, __LINE__, "sd", "proxy-FDEVENT_ERR, but no HUP", revents);
+
++ con->file_finished = 1;
+ joblist_append(srv, con);
+ proxy_connection_close(srv, hctx);
+ }
+Index: src/Makefile.am
+===================================================================
+--- src/Makefile.am (.../tags/lighttpd-1.4.26)
++++ src/Makefile.am (.../branches/lighttpd-1.4.x)
+@@ -19,7 +19,7 @@
+ REVISION=""; \
+ fi; \
+ fi; \
+- if test -z "$$REVISION" -a -x "`which git`"; then \
++ if test -z "$$REVISION" -a -d "$(top_srcdir)/.git" -a -x "`which git`"; then \
+ REVISION="$$(cd "$(top_srcdir)"; LANG= LC_ALL=C git describe --always 2>/dev/null || echo)"; \
+ fi; \
+ if test -n "$$REVISION"; then \
+Index: src/mod_compress.c
===================================================================
---- tests/mod-cgi.t (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ tests/mod-cgi.t (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -8,7 +8,7 @@
-
- use strict;
- use IO::Socket;
--use Test::More tests => 15;
-+use Test::More tests => 16;
- use LightyTest;
+--- src/mod_compress.c (.../tags/lighttpd-1.4.26)
++++ src/mod_compress.c (.../branches/lighttpd-1.4.x)
+@@ -744,6 +744,7 @@
+ int accept_encoding = 0;
+ char *value = ds->value->ptr;
+ int matched_encodings = 0;
++ int use_etag = sce->etag != NULL && sce->etag->ptr != NULL;
+
+ /* get client side support encodings */
+ #ifdef USE_ZLIB
+@@ -770,12 +771,14 @@
+ mtime = strftime_cache_get(srv, sce->st.st_mtime);
+
+ /* try matching original etag of uncompressed version */
+- etag_mutate(con->physical.etag, sce->etag);
+- if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
+- response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+- response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+- response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
+- return HANDLER_FINISHED;
++ if (use_etag) {
++ etag_mutate(con->physical.etag, sce->etag);
++ if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
++ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
++ response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
++ response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++ return HANDLER_FINISHED;
++ }
+ }
- my $tf = LightyTest->new();
-@@ -115,6 +115,13 @@
- );
- $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ];
- ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
-+# broken header crash
-+$t->{REQUEST} = ( <<EOF
-+GET /crlfcrash.pl HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 500 } ];
-+ok($tf->handle_http($t) == 0, 'broken header via perl cgi');
+ /* select best matching encoding */
+@@ -790,22 +793,26 @@
+ compression_name = dflt_deflate;
+ }
- ok($tf->stop_proc == 0, "Stopping lighttpd");
+- /* try matching etag of compressed version */
+- buffer_copy_string_buffer(srv->tmp_buf, sce->etag);
+- buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("-"));
+- buffer_append_string(srv->tmp_buf, compression_name);
+- etag_mutate(con->physical.etag, srv->tmp_buf);
++ if (use_etag) {
++ /* try matching etag of compressed version */
++ buffer_copy_string_buffer(srv->tmp_buf, sce->etag);
++ buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("-"));
++ buffer_append_string(srv->tmp_buf, compression_name);
++ etag_mutate(con->physical.etag, srv->tmp_buf);
++ }
+
+ if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) {
+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+ response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+- response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++ if (use_etag) {
++ response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++ }
+ return HANDLER_FINISHED;
+ }
-Index: tests/docroot/www/crlfcrash.pl
-===================================================================
---- tests/docroot/www/crlfcrash.pl (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/docroot/www/crlfcrash.pl (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,4 @@
-+#!/usr/bin/env perl
-+#
-+print "Location: http://www.example.org/\r\n\n\n";
-+exit;
-Index: tests/docroot/www/404.pl
-===================================================================
---- tests/docroot/www/404.pl (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/docroot/www/404.pl (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,33 @@
-+#!/usr/bin/perl
-+use CGI qw/:standard/;
-+my $cgi = new CGI;
-+my $request_uri = $ENV{'REQUEST_URI'};
-+print (STDERR "REQUEST_URI: $request_uri\n");
-+
-+if ($request_uri =~ m/^\/dynamic\/200\// ) {
-+ print header ( -status => 200,
-+ -type => 'text/plain' );
-+ print ("found here\n");
-+}
-+elsif ($request_uri =~ m|^/dynamic/302/| ) {
-+ print header( -status=>302,
-+ -location => 'http://www.example.org/');
-+}
-+elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
-+ print header ( -status => 404
-+ -type => 'text/plain' );
-+ print ("Not found here\n");
-+}
-+elsif ($request_uri =~ m/^\/send404\.pl/ ) {
-+ print header ( -status => 404
-+ -type => 'text/plain' );
-+ print ("Not found here (send404)\n");
-+}
-+elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) {
-+ print ("found here\n");
-+}
-+else {
-+ print header ( -status => 500,
-+ -type => 'text/plain');
-+ print ("huh\n");
-+};
-
-Property changes on: tests/docroot/www/404.pl
-___________________________________________________________________
-Name: svn:executable
- + *
-
-Index: tests/docroot/www/send404.pl
-===================================================================
---- tests/docroot/www/send404.pl (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/docroot/www/send404.pl (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,5 @@
-+#!/usr/bin/perl
-+use CGI qw/:standard/;
-+print header ( -status => 404
-+ -type => 'text/plain' );
-+print ("send404\n");
-
-Property changes on: tests/docroot/www/send404.pl
-___________________________________________________________________
-Name: svn:executable
- + *
-
-Index: tests/docroot/www/404.html
-===================================================================
---- tests/docroot/www/404.html (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/docroot/www/404.html (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1 @@
-+static not found
-Index: tests/docroot/www/404.fcgi
-===================================================================
---- tests/docroot/www/404.fcgi (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/docroot/www/404.fcgi (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,27 @@
-+#!/usr/bin/perl
-+#use CGI qw/:standard/;
-+use CGI::Fast qw(:standard);
-+my $cgi = new CGI;
-+while (new CGI::Fast) {
-+ my $request_uri = $ENV{'REQUEST_URI'};
-+ print (STDERR "REQUEST_URI: $request_uri\n");
-+ if ($request_uri =~ m/^\/dynamic\/200\// ) {
-+ print header ( -status => 200,
-+ -type => 'text/plain' );
-+ print ("found here\n");
-+ }
-+ elsif ($request_uri =~ m|^/dynamic/302/| ) {
-+ print header( -status=>302,
-+ -location => 'http://www.example.org/');
-+ }
-+ elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
-+ print header ( -status => 404
-+ -type => 'text/plain' );
-+ print ("Not found here\n");
-+ }
-+ else {
-+ print header ( -status => 500,
-+ -type => 'text/plain');
-+ print ("huh\n");
-+ };
-+};
-
-Property changes on: tests/docroot/www/404.fcgi
-___________________________________________________________________
-Name: svn:executable
- + *
-
-Index: tests/core-404-handler.t
-===================================================================
---- tests/core-404-handler.t (.../tags/lighttpd-1.4.16) (revision 0)
-+++ tests/core-404-handler.t (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -0,0 +1,76 @@
-+#!/usr/bin/env perl
-+#
-+# combinations we have to test:
-+# plain 404 case
-+# 404-handler -> static file (verify content)
-+# 404-handler -> fastcgi
-+# returning 200
-+# returning 302 + Location
-+# returning 404
-+# returning no status -> 200
-+#
-+BEGIN {
-+ # add current source dir to the include-path
-+ # we need this for make distcheck
-+ (my $srcdir = $0) =~ s#/[^/]+$#/#;
-+ unshift @INC, $srcdir;
-+}
-+
-+use strict;
-+use IO::Socket;
-+use Test::More tests => 8;
-+use LightyTest;
-+
-+my $tf = LightyTest->new();
-+my $t;
-+$tf->{CONFIGFILE} = '404-handler.conf';
-+
-+ok($tf->start_proc == 0, "Starting lighttpd") or die();
-+
-+$t->{REQUEST} = ( <<EOF
-+GET /static/notfound HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "static not found\n" } ];
-+ok($tf->handle_http($t) == 0, '404 handler => static');
-+
-+#
-+#
-+#
-+$t->{REQUEST} = ( <<EOF
-+GET /dynamic/200/notfound HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
-+ok($tf->handle_http($t) == 0, '404 handler => dynamic(200)');
-+
-+$t->{REQUEST} = ( <<EOF
-+GET /dynamic/302/notfound HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => "http://www.example.org/" } ];
-+ok($tf->handle_http($t) == 0, '404 handler => dynamic(302)');
-+
-+$t->{REQUEST} = ( <<EOF
-+GET /dynamic/404/notfound HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "Not found here\n" } ];
-+ok($tf->handle_http($t) == 0, '404 handler => dynamic(404)');
-+
-+$t->{REQUEST} = ( <<EOF
-+GET /dynamic/nostatus/notfound HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
-+ok($tf->handle_http($t) == 0, '404 handler => dynamic(nostatus)');
-+
-+$t->{REQUEST} = ( <<EOF
-+GET /send404.pl HTTP/1.0
-+EOF
-+ );
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "send404\n" } ];
-+ok($tf->handle_http($t) == 0, '404 generated by CGI should stay 404');
-+
-+ok($tf->stop_proc == 0, "Stopping lighttpd");
-+
-Index: doc/lighttpd.conf
+ /* deflate it */
+- if (p->conf.compress_cache_dir->used) {
++ if (use_etag && p->conf.compress_cache_dir->used) {
+ if (0 != deflate_file_to_file(srv, con, p, con->physical.path, sce, compression_type))
+ return HANDLER_GO_ON;
+ } else {
+@@ -814,7 +821,9 @@
+ }
+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
+ response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+- response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++ if (use_etag) {
++ response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++ }
+ response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+ /* let mod_staticfile handle the cached compressed files, physical path was modified */
+ return p->conf.compress_cache_dir->used ? HANDLER_GO_ON : HANDLER_FINISHED;
+Index: configure.ac
+===================================================================
+Index: SConstruct
===================================================================
---- doc/lighttpd.conf (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -37,10 +37,10 @@
-
- ## a static document-root, for virtual-hosting take look at the
- ## server.virtual-* options
--server.document-root = "/www/pages/"
-+server.document-root = "/srv/www/htdocs/"
-
- ## where to send error-messages to
--server.errorlog = "/www/logs/lighttpd.error.log"
-+server.errorlog = "/var/log/lighttpd/error.log"
-
- # files to check for if .../ is requested
- index-file.names = ( "index.php", "index.html",
-@@ -101,7 +101,9 @@
- ".wmv" => "video/x-ms-wmv",
- ".bz2" => "application/x-bzip",
- ".tbz" => "application/x-bzip-compressed-tar",
-- ".tar.bz2" => "application/x-bzip-compressed-tar"
-+ ".tar.bz2" => "application/x-bzip-compressed-tar",
-+ # default mime type
-+ "" => "application/octet-stream",
- )
-
- # Use the "Content-Type" extended attribute to obtain mime type if possible
-@@ -113,7 +115,7 @@
- # server.tag = "lighttpd"
-
- #### accesslog module
--accesslog.filename = "/www/logs/access.log"
-+accesslog.filename = "/var/log/lighttpd/access.log"
-
- ## deny access the file-extensions
- #
-@@ -138,7 +140,7 @@
- #server.port = 81
-
- ## bind to localhost (default: all interfaces)
--#server.bind = "grisu.home.kneschke.de"
-+#server.bind = "127.0.0.1"
-
- ## error-handler for status 404
- #server.error-handler-404 = "/error-handler.html"
-@@ -158,15 +160,16 @@
- ## or
- ## virtual-server-root + http-host + virtual-server-docroot
- ##
--#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
--#simple-vhost.default-host = "grisu.home.kneschke.de"
--#simple-vhost.document-root = "/pages/"
-+#simple-vhost.server-root = "/srv/www/vhosts/"
-+#simple-vhost.default-host = "www.example.org"
-+#simple-vhost.document-root = "/htdocs/"
-
-
- ##
- ## Format: <errorfile-prefix><status-code>.html
- ## -> ..../status-404.html for 'File not found'
--#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-"
-+#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
-+#server.errorfile-prefix = "/srv/www/errors/status-"
-
- ## virtual directory listings
- #dir-listing.activate = "enable"
-@@ -189,7 +192,7 @@
- #server.groupname = "wwwrun"
-
- #### compress module
--#compress.cache-dir = "/tmp/lighttpd/cache/compress/"
-+#compress.cache-dir = "/var/cache/lighttpd/compress/"
- #compress.filetype = ("text/plain", "text/html")
-
- #### proxy module
-@@ -209,8 +212,8 @@
- #fastcgi.server = ( ".php" =>
- # ( "localhost" =>
- # (
--# "socket" => "/tmp/php-fastcgi.socket",
--# "bin-path" => "/usr/local/bin/php"
-+# "socket" => "/var/run/lighttpd/php-fastcgi.socket",
-+# "bin-path" => "/usr/local/bin/php-cgi"
- # )
- # )
- # )
-@@ -222,7 +225,7 @@
-
- #### SSL engine
- #ssl.engine = "enable"
--#ssl.pemfile = "server.pem"
-+#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
-
- #### status module
- #status.status-url = "/server-status"
-@@ -269,7 +272,7 @@
- # %3 => subdomain 1 name
- # %4 => subdomain 2 name
- #
--#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
-+#evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/"
-
- #### expire module
- #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
-@@ -279,14 +282,14 @@
-
- #### rrdtool
- #rrdtool.binary = "/usr/bin/rrdtool"
--#rrdtool.db-name = "/var/www/lighttpd.rrd"
-+#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
-
- #### setenv
- #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
- #setenv.add-response-header = ( "X-Secret-Message" => "42" )
-
- ## for mod_trigger_b4_dl
--# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
-+# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
- # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
- # trigger-before-download.trigger-url = "^/trigger/"
- # trigger-before-download.download-url = "^/download/"
Index: NEWS
===================================================================
---- NEWS (.../tags/lighttpd-1.4.16) (revision 1922)
-+++ NEWS (.../branches/lighttpd-1.4.x) (revision 1922)
-@@ -3,6 +3,13 @@
+--- NEWS (.../tags/lighttpd-1.4.26)
++++ NEWS (.../branches/lighttpd-1.4.x)
+@@ -3,7 +3,16 @@
NEWS
====
-+- 1.4.17 -
-+ * added dir-listing.set-footer in mod_dirlisting (#1277)
-+ * fixed hardcoded font-sizes in mod_dirlisting (#1267)
-+ * fixed different ETag length on 32/64 platforms (#1279)
-+ * fixed compression of files < 128 bytes by disabling compression (#1241)
-+ * fixed mysql server reconnects (#518)
-+
- - 1.4.16 -
-
- * added static-file.etags, etag.use-inode, etag.use-mtime, etag.use-size
+-- 1.4.26 -
++- 1.4.27 -
++ * Fix handling return value of SSL_CTX_set_options (fixes #2157, thx mlcreech)
++ * Fix mod_proxy HUP handling (send final chunk, fix usage counter)
++ * mod_proxy: close connection on write error (fixes #2114)
++ * Check uri instead of physical path for directory redirect
++ * Fix detecting git repository (fixes #2173, thx ncopa)
++ * [mod_compress] Fix segfault when etags are disabled (fixes #2169)
++ * Reset uri.authority before TLS servername handling, reset all "keep-alive" data in connection_del (fixes #2125)
++
++- 1.4.26 - 2010-02-07
+ * Fix request parser to handle packets with splitted \r\n\r\n (fixes #2105)
+ * Remove dependency on automake >= 1.11 with m4_ifdef check
+ * mod_accesslog: support %e (fixes #2113, thx presbrey)
+Index: CMakeLists.txt
+===================================================================