-Index: configure.in
+# Revision 2724
+Index: src/connections.c
===================================================================
---- configure.in (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ configure.in (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -1,7 +1,7 @@
- # -*- Autoconf -*-
- # Process this file with autoconf to produce a configure script.
- AC_PREREQ(2.57)
--AC_INIT(lighttpd, 1.4.18, jan@kneschke.de)
-+AC_INIT(lighttpd, 1.4.19, jan@kneschke.de)
- AC_CONFIG_SRCDIR([src/server.c])
-
- AC_CANONICAL_TARGET
-Index: src/configfile-glue.c
+--- 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/configfile-glue.c (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -341,6 +341,10 @@
- }
- break;
- }
-+ case COMP_HTTP_SCHEME:
-+ l = con->uri.scheme;
-+ break;
+--- 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);
+
- case COMP_HTTP_URL:
- l = con->uri.path;
- break;
-Index: src/array.h
+ 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/array.h (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ src/array.h (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -90,6 +90,7 @@
- COMP_HTTP_COOKIE,
- COMP_HTTP_REMOTEIP,
- COMP_HTTP_QUERYSTRING,
-+ COMP_HTTP_SCHEME,
-
- COMP_LAST_ELEMENT
- } comp_key_t;
-Index: src/mod_staticfile.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_staticfile.c (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -483,8 +483,24 @@
- /* if the value is the same as our ETag, we do a Range-request,
- * otherwise a full 200 */
-
-- if (!buffer_is_equal(ds->value, con->physical.etag)) {
-+ if (ds->value->ptr[0] == '"') {
-+ /**
-+ * client wants a ETag
-+ */
-+ if (!con->physical.etag) {
-+ do_range_request = 0;
-+ } else if (!buffer_is_equal(ds->value, con->physical.etag)) {
-+ do_range_request = 0;
-+ }
-+ } else if (!mtime) {
-+ /**
-+ * we don't have a Last-Modified and can match the If-Range:
-+ *
-+ * sending all
-+ */
- do_range_request = 0;
-+ } else if (!buffer_is_equal(ds->value, mtime)) {
-+ do_range_request = 0;
- }
+--- 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);
+
+- 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);
+
+- return HANDLER_WAIT_FOR_EVENT;
++ return HANDLER_ERROR;
}
-Index: src/response.c
+ 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);
+
+@@ -1077,8 +1079,11 @@
+ return HANDLER_FINISHED;
+ }
+
++ if (!con->file_finished) {
++ http_chunk_append_mem(srv, con, NULL, 0);
++ }
++
+ 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/response.c (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ src/response.c (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -180,6 +180,7 @@
- buffer_copy_string_buffer(con->uri.authority, con->request.http_host);
- buffer_to_lower(con->uri.authority);
-
-+ config_patch_connection(srv, con, COMP_HTTP_SCHEME); /* Scheme: */
- config_patch_connection(srv, con, COMP_HTTP_HOST); /* Host: */
- config_patch_connection(srv, con, COMP_HTTP_REMOTEIP); /* Client-IP */
- config_patch_connection(srv, con, COMP_HTTP_REFERER); /* Referer: */
-Index: src/configparser.y
+--- 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
===================================================================
---- src/configparser.y (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ src/configparser.y (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -422,6 +422,7 @@
- { COMP_HTTP_COOKIE, CONST_STR_LEN("HTTP[\"cookie\"]" ) },
- { COMP_HTTP_REMOTEIP, CONST_STR_LEN("HTTP[\"remoteip\"]" ) },
- { COMP_HTTP_QUERYSTRING, CONST_STR_LEN("HTTP[\"querystring\"]") },
-+ { COMP_HTTP_SCHEME, CONST_STR_LEN("HTTP[\"scheme\"]" ) },
- { COMP_UNSET, NULL, 0 },
- };
- size_t i;
-Index: doc/configuration.txt
+--- 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;
++ }
+ }
+
+ /* select best matching encoding */
+@@ -790,22 +793,26 @@
+ compression_name = dflt_deflate;
+ }
+
+- /* 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;
+ }
+
+ /* 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
===================================================================
---- doc/configuration.txt (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ doc/configuration.txt (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -85,6 +85,8 @@
-
- $HTTP["cookie"]
- match on cookie
-+$HTTP["scheme"]
-+ match on scheme
- $HTTP["host"]
- match on host
- $HTTP["useragent"]
Index: SConstruct
===================================================================
---- SConstruct (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ SConstruct (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -5,7 +5,7 @@
- from stat import *
-
- package = 'lighttpd'
--version = '1.4.18'
-+version = '1.4.19'
-
- def checkCHeaders(autoconf, hdrs):
- p = re.compile('[^A-Z0-9]')
Index: NEWS
===================================================================
---- NEWS (.../tags/lighttpd-1.4.18) (revision 2015)
-+++ NEWS (.../branches/lighttpd-1.4.x) (revision 2015)
-@@ -3,6 +3,11 @@
+--- NEWS (.../tags/lighttpd-1.4.26)
++++ NEWS (.../branches/lighttpd-1.4.x)
+@@ -3,7 +3,16 @@
NEWS
====
-+- 1.4.19 -
-+
-+ * added support for If-Range: <date> (#1346)
-+ * added support for matching $HTTP["scheme"] in configs
+-- 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.18 - 2007-09-09
-
- * fixed compile error on IRIX 6.5.x on prctl() (#1333)
++- 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
+===================================================================