]> git.pld-linux.org Git - packages/lighttpd.git/blobdiff - lighttpd-branch.diff
no dist-xz for ac
[packages/lighttpd.git] / lighttpd-branch.diff
index 940e29cff422c4982c98e7836488c0473638b8c2..76f06ce17cb591b31c716dc962d936cf96c36b2c 100644 (file)
-Index: lighttpd.spec.in
+# Revision 2815
+Index: src/http_auth_digest.c
 ===================================================================
---- lighttpd.spec.in   (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ lighttpd.spec.in   (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -1,83 +0,0 @@
--Summary: A fast webserver with minimal memory-footprint (lighttpd)
--Name: lighttpd
--Version: @VERSION@
--Release: 1
--Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-%version.tar.gz
--Packager: Jan Kneschke <jan@kneschke.de>
--License: BSD
--Group: Networking/Daemons
--URL: http://www.lighttpd.net/
--Requires: pcre >= 3.1 zlib
--BuildRequires: libtool zlib-devel
--BuildRoot: %{_tmppath}/%{name}-root
+--- src/http_auth_digest.c     (.../tags/lighttpd-1.4.29)
++++ src/http_auth_digest.c     (.../branches/lighttpd-1.4.x)
+@@ -1,26 +0,0 @@
+-#include "buffer.h"
 -
--%description
--lighttpd is intented to be a frontend for ad-servers which have to deliver
--small files concurrently to many connections.
+-#include "http_auth_digest.h"
 -
--Available rpmbuild rebuild options:
----with: ssl mysql lua memcache
+-#include <string.h>
 -
--%prep
--%setup -q
+-#ifndef USE_OPENSSL
+-# include "md5.h"
 -
--%build
--rm -rf %{buildroot}
--%configure \
--    %{?_with_mysql:       --with-mysql} \
--    %{?_with_lua:         --with-lua} \
--    %{?_with_memcache:    --with-memcache} \
--    %{?_with_ssl:         --with-openssl}
--make
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
 -
--%install
--%makeinstall
+-#endif
 -
--mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig}
--if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
--      install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd
--else
--      install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd
--fi
--install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd
+-void CvtHex(IN HASH Bin, OUT HASHHEX Hex) {
+-      unsigned short i;
 -
--%clean
--rm -rf %{buildroot}
--
--%post
--## read http://www.fedora.us/docs/spec.html next time :)
--if [ "$1" = "1" ]; then
--      # real install, not upgrade
--      /sbin/chkconfig --add lighttpd
--fi
+-      for (i = 0; i < HASHLEN; i++) {
+-              Hex[i*2] = int2hex((Bin[i] >> 4) & 0xf);
+-              Hex[i*2+1] = int2hex(Bin[i] & 0xf);
+-      }
+-      Hex[HASHHEXLEN] = '\0';
+-}
 -
--%preun
--if [ "$1" = "0"]; then
--      # real uninstall, not upgrade
--      %{_sysconfdir}/init.d/lighttpd stop
--      /sbin/chkconfig --del lighttpd
--fi
+Index: src/http_auth_digest.h
+===================================================================
+--- src/http_auth_digest.h     (.../tags/lighttpd-1.4.29)
++++ src/http_auth_digest.h     (.../branches/lighttpd-1.4.x)
+@@ -1,24 +0,0 @@
+-#ifndef _DIGCALC_H_
+-#define _DIGCALC_H_
 -
--%files
--%defattr(-,root,root)
--%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS
--%doc doc/*.txt
--%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/init.d/lighttpd
--%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/lighttpd
--%{_mandir}/*
--%{_libdir}/*
--%{_sbindir}/*
--%{_bindir}/*
+-#ifdef HAVE_CONFIG_H
+-# include "config.h"
+-#endif
 -
--%changelog
--* Thu Sep 30 2004 12:41 <jan@kneschke.de> 1.3.1
--- upgraded to 1.3.1
+-#define HASHLEN 16
+-typedef unsigned char HASH[HASHLEN];
+-#define HASHHEXLEN 32
+-typedef char HASHHEX[HASHHEXLEN+1];
+-#ifdef USE_OPENSSL
+-#define IN const
+-#else
+-#define IN
+-#endif
+-#define OUT
 -
--* Tue Jun 29 2004 17:26 <jan@kneschke.de> 1.2.3
--- rpmlint'ed the package
--- added URL
--- added (noreplace) to start-script
--- change group to Networking/Daemon (like apache)
+-void CvtHex(
+-    IN HASH Bin,
+-    OUT HASHHEX Hex
+-    );
 -
--* Sun Feb 23 2003 15:04 <jan@kneschke.de>
--- initial version
-Index: configure.in
-===================================================================
-Index: src/mod_ssi_exprparser.h
+-#endif
+Index: src/network_write.c
 ===================================================================
---- src/mod_ssi_exprparser.h   (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_ssi_exprparser.h   (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -1,12 +0,0 @@
--#define TK_AND                             1
--#define TK_OR                              2
--#define TK_EQ                              3
--#define TK_NE                              4
--#define TK_GT                              5
--#define TK_GE                              6
--#define TK_LT                              7
--#define TK_LE                              8
--#define TK_NOT                             9
--#define TK_LPARAN                         10
--#define TK_RPARAN                         11
--#define TK_VALUE                          12
-Index: src/configfile-glue.c
-===================================================================
---- src/configfile-glue.c      (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/configfile-glue.c      (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -529,7 +529,7 @@
- int config_append_cond_match_buffer(connection *con, data_config *dc, buffer *buf, int n)
- {
-       cond_cache_t *cache = &con->cond_cache[dc->context_ndx];
--      if (n > cache->patterncount) {
-+      if (n >= cache->patterncount) {
-               return 0;
-       }
+--- src/network_write.c        (.../tags/lighttpd-1.4.29)
++++ src/network_write.c        (.../branches/lighttpd-1.4.x)
+@@ -24,17 +24,16 @@
+ # include <sys/resource.h>
+ #endif
  
-Index: src/mod_cgi.c
-===================================================================
---- src/mod_cgi.c      (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_cgi.c      (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -987,6 +987,8 @@
-                       *c = '/';
-               }
+-int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq) {
++int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes) {
+       chunk *c;
+-      size_t chunks_written = 0;
  
-+              openDevNull(STDERR_FILENO);
-+
-               /* we don't need the client socket */
-               for (i = 3; i < 256; i++) {
-                       if (i != srv->errorlog_fd) close(i);
-@@ -995,7 +997,7 @@
-               /* exec the cgi */
-               execve(args[0], args, env.ptr);
--              log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]);
-+              /* log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]); */
-               /* */
-               SEGFAULT();
-@@ -1058,8 +1060,9 @@
-                                               switch(errno) {
-                                               case ENOSPC:
-                                                       con->http_status = 507;
--
-                                                       break;
-+                                              case EINTR:
-+                                                      continue;
-                                               default:
-                                                       con->http_status = 403;
-                                                       break;
-@@ -1071,8 +1074,9 @@
-                                               switch(errno) {
-                                               case ENOSPC:
-                                                       con->http_status = 507;
--
-                                                       break;
-+                                              case EINTR:
-+                                                      continue;
-                                               default:
-                                                       con->http_status = 403;
-                                                       break;
-@@ -1087,6 +1091,8 @@
-                                       c->offset += r;
-                                       cq->bytes_out += r;
-                               } else {
-+                                      log_error_write(srv, __FILE__, __LINE__, "ss", "write() failed due to: ", strerror(errno)); 
-+                                      con->http_status = 500;
-                                       break;
-                               }
-                               chunkqueue_remove_finished_chunks(cq);
-Index: src/mod_rewrite.c
-===================================================================
---- src/mod_rewrite.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_rewrite.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -385,8 +385,7 @@
-                       start = 0; end = pattern_len;
-                       for (k = 0; k < pattern_len; k++) {
--                              if ((pattern[k] == '$' || pattern[k] == '%') &&
--                                  isdigit((unsigned char)pattern[k + 1])) {
-+                              if (pattern[k] == '$' || pattern[k] == '%') {
-                                       /* got one */
-                                       size_t num = pattern[k + 1] - '0';
-@@ -395,7 +394,10 @@
-                                       buffer_append_string_len(con->request.uri, pattern + start, end - start);
--                                      if (pattern[k] == '$') {
-+                                      if (!isdigit((unsigned char)pattern[k + 1])) {
-+                                              /* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
-+                                              buffer_append_string_len(con->request.uri, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
-+                                      } else if (pattern[k] == '$') {
-                                               /* n is always > 0 */
-                                               if (num < (size_t)n) {
-                                                       buffer_append_string(con->request.uri, list[num]);
-Index: src/lempar.c
-===================================================================
---- src/lempar.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/lempar.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -210,7 +210,7 @@
- */
- const char *ParseTokenName(int tokenType){
- #ifndef NDEBUG
--  if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
-+  if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){
-     return yyTokenName[tokenType];
-   }else{
-     return "Unknown";
-@@ -335,7 +335,7 @@
-     return YY_NO_ACTION;
-   }
-   i += iLookAhead;
--  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
-+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
- #ifdef YYFALLBACK
-     int iFallback;            /* Fallback token */
-     if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
-@@ -378,7 +378,7 @@
-     return YY_NO_ACTION;
-   }
-   i += iLookAhead;
--  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
-+  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
-     return yy_default[stateno];
-   }else{
-     return yy_action[i];
-@@ -456,7 +456,7 @@
-   yymsp = &yypParser->yystack[yypParser->yyidx];
- #ifndef NDEBUG
-   if( yyTraceFILE && yyruleno>=0
--        && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
-+        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
-     fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
-       yyRuleName[yyruleno]);
-   }
-@@ -511,6 +511,8 @@
-   int yymajor,                   /* The major type of the error token */
-   YYMINORTYPE yyminor            /* The minor type of the error token */
- ){
-+  UNUSED(yymajor);
-+  UNUSED(yyminor);
-   ParseARG_FETCH;
- #define TOKEN (yyminor.yy0)
- %%
-Index: src/connections.c
-===================================================================
---- src/connections.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/connections.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -199,6 +199,7 @@
+-      for(c = cq->first; c; c = c->next) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
  
-       /* don't resize the buffer if we were in SSL_ERROR_WANT_* */
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
  
-+      ERR_clear_error();
-       do {
-               if (!con->ssl_error_want_reuse_buffer) {
-                       b = buffer_init();
-@@ -299,6 +300,8 @@
+                       if (c->mem->used == 0) {
+@@ -44,6 +43,8 @@
  
-       return 0;
- #else
-+      UNUSED(srv);
-+      UNUSED(con);
-       return -1;
+                       offset = c->mem->ptr + c->offset;
+                       toSend = c->mem->used - 1 - c->offset;
++                      if (toSend > max_bytes) toSend = max_bytes;
++
+ #ifdef __WIN32
+                       if ((r = send(fd, offset, toSend, 0)) < 0) {
+                               /* no error handling for windows... */
+@@ -72,6 +73,7 @@
+                       c->offset += r;
+                       cq->bytes_out += r;
++                      max_bytes -= r;
+                       if (c->offset == (off_t)c->mem->used - 1) {
+                               chunk_finished = 1;
+@@ -85,7 +87,7 @@
  #endif
- }
-@@ -427,21 +430,22 @@
-       }
+                       ssize_t r;
+                       off_t offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       stat_cache_entry *sce = NULL;
+                       int ifd;
  
-       switch(con->http_status) {
--      case 400: /* class: header + custom body */
--      case 401:
--      case 403:
--      case 404:
--      case 408:
--      case 409:
--      case 411:
--      case 416:
--      case 423:
--      case 500:
--      case 501:
--      case 503:
--      case 505:
-+      case 204: /* class: header only */
-+      case 205:
-+      case 304:
-+              /* disable chunked encoding again as we have no body */
-+              con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
-+              con->parsed_response &= ~HTTP_CONTENT_LENGTH;
-+              chunkqueue_reset(con->write_queue);
-+
-+              con->file_finished = 1;
-+              break;
-+      default: /* class: header + body */
-               if (con->mode != DIRECT) break;
+@@ -98,6 +100,8 @@
+                       offset = c->file.start + c->offset;
+                       toSend = c->file.length - c->offset;
  
-+              /* only custom body for 4xx and 5xx */
-+              if (con->http_status < 400 || con->http_status >= 600) break;
++                      if (toSend > max_bytes) toSend = max_bytes;
 +
-               con->file_finished = 0;
+                       if (offset > sce->st.st_size) {
+                               log_error_write(srv, __FILE__, __LINE__, "sb", "file was shrinked:", c->file.name);
  
-               buffer_reset(con->physical.path);
-@@ -451,7 +455,8 @@
-                       stat_cache_entry *sce = NULL;
+@@ -181,6 +185,7 @@
  
-                       buffer_copy_string_buffer(con->physical.path, con->conf.errorfile_prefix);
--                      buffer_append_string(con->physical.path, get_http_status_body_name(con->http_status));
-+                      buffer_append_long(con->physical.path, con->http_status);
-+                      buffer_append_string_len(con->physical.path, CONST_STR_LEN(".html"));
+                       c->offset += r;
+                       cq->bytes_out += r;
++                      max_bytes -= r;
  
-                       if (HANDLER_ERROR != stat_cache_get_entry(srv, con, con->physical.path, &sce)) {
-                               con->file_finished = 1;
-@@ -497,30 +502,7 @@
+                       if (c->offset == c->file.length) {
+                               chunk_finished = 1;
+@@ -200,11 +205,9 @@
  
-                       response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
+                       break;
                }
--              /* fall through */
--      case 207:
--      case 200: /* class: header + body */
--      case 201:
--      case 300:
--      case 301:
--      case 302:
--      case 303:
--      case 307:
-               break;
--
--      case 206: /* write_queue is already prepared */
--              break;
--      case 204:
--      case 205: /* class: header only */
--      case 304:
--      default:
--              /* disable chunked encoding again as we have no body */
--              con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
--              con->parsed_response &= ~HTTP_CONTENT_LENGTH;
--              chunkqueue_reset(con->write_queue);
 -
--              con->file_finished = 1;
--              break;
-       }
-       if (con->file_finished) {
-@@ -544,7 +526,7 @@
-                               data_string *ds;
-                               /* no Content-Body, no Content-Length */
-                               if (NULL != (ds = (data_string*) array_get_element(con->response.headers, "Content-Length"))) {
--                                      buffer_reset(ds->value); // Headers with empty values are ignored for output
-+                                      buffer_reset(ds->value); /* Headers with empty values are ignored for output */
-                               }
-                       } else if (qlen > 0 || con->request.http_method != HTTP_METHOD_HEAD) {
-                               /* qlen = 0 is important for Redirects (301, ...) as they MAY have
-@@ -846,7 +828,7 @@
+-              chunks_written++;
        }
  
-       /* The cond_cache gets reset in response.c */
--//    config_cond_cache_reset(srv, con);
-+      /* config_cond_cache_reset(srv, con); */
- #ifdef USE_OPENSSL
-       if (con->ssl_error_want_reuse_buffer) {
-@@ -1668,21 +1650,51 @@
-                       }
- #ifdef USE_OPENSSL
-                       if (srv_sock->is_ssl) {
--                              int ret;
-+                              int ret, ssl_r;
-+                              unsigned long err;
-+                              ERR_clear_error();
-                               switch ((ret = SSL_shutdown(con->ssl))) {
-                               case 1:
-                                       /* ok */
-                                       break;
-                               case 0:
--                                      SSL_shutdown(con->ssl);
--                                      break;
-+                                      ERR_clear_error();
-+                                      if (-1 != (ret = SSL_shutdown(con->ssl))) break;
-+
-+                                      /* fall through */
-                               default:
--                                      log_error_write(srv, __FILE__, __LINE__, "sds", "SSL:",
--                                                      SSL_get_error(con->ssl, ret),
--                                                      ERR_error_string(ERR_get_error(), NULL));
--                                      return -1;
-+
-+                                      switch ((ssl_r = SSL_get_error(con->ssl, ret))) {
-+                                      case SSL_ERROR_WANT_WRITE:
-+                                      case SSL_ERROR_WANT_READ:
-+                                              break;
-+                                      case SSL_ERROR_SYSCALL:
-+                                              /* perhaps we have error waiting in our error-queue */
-+                                              if (0 != (err = ERR_get_error())) {
-+                                                      do {
-+                                                              log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
-+                                                                              ssl_r, ret,
-+                                                                              ERR_error_string(err, NULL));
-+                                                      } while((err = ERR_get_error()));
-+                                              } else {
-+                                                      log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
-+                                                                      ssl_r, ret, errno,
-+                                                                      strerror(errno));
-+                                              }
-+      
-+                                              break;
-+                                      default:
-+                                              while((err = ERR_get_error())) {
-+                                                      log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
-+                                                                      ssl_r, ret,
-+                                                                      ERR_error_string(err, NULL));
-+                                              }
-+      
-+                                              break;
-+                                      }
-                               }
-                       }
-+                      ERR_clear_error();
- #endif
+-      return chunks_written;
++      return 0;
+ }
  
-                       switch(con->mode) {
-Index: src/configfile.c
+ #if 0
+Index: src/mod_secure_download.c
 ===================================================================
---- src/configfile.c   (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/configfile.c   (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -7,6 +7,7 @@
+--- src/mod_secure_download.c  (.../tags/lighttpd-1.4.29)
++++ src/mod_secure_download.c  (.../branches/lighttpd-1.4.x)
+@@ -8,18 +8,8 @@
+ #include <stdlib.h>
  #include <string.h>
- #include <stdio.h>
- #include <ctype.h>
-+#include <limits.h>
- #include <assert.h>
  
- #include "server.h"
-@@ -305,9 +306,6 @@
-               data_config *dc = (data_config *)srv->config_context->data[i];
-               specific_config *s = srv->config_storage[i];
+-#ifdef USE_OPENSSL
+-# include <openssl/md5.h>
+-#else
+-# include "md5.h"
++#include "md5.h"
  
--              /* not our stage */
--              if (comp != dc->comp) continue;
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
+-
+-#endif
 -
-               /* condition didn't match */
-               if (!config_check_cond(srv, con, dc)) continue;
+ #define HASHLEN 16
+ typedef unsigned char HASH[HASHLEN];
+ #define HASHHEXLEN 32
+@@ -200,7 +190,7 @@
  
-@@ -410,8 +408,8 @@
+ URIHANDLER_FUNC(mod_secdownload_uri_handler) {
+       plugin_data *p = p_d;
+-      MD5_CTX Md5Ctx;
++      li_MD5_CTX Md5Ctx;
+       HASH HA1;
+       const char *rel_uri, *ts_str, *md5_str;
+       time_t ts = 0;
+@@ -266,9 +256,9 @@
+       buffer_append_string(p->md5, rel_uri);
+       buffer_append_string_len(p->md5, ts_str, 8);
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)p->md5->ptr, p->md5->used - 1);
+-      MD5_Final(HA1, &Md5Ctx);
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)p->md5->ptr, p->md5->used - 1);
++      li_MD5_Final(HA1, &Md5Ctx);
+       buffer_copy_string_hex(p->md5, (char *)HA1, 16);
+Index: src/base.h
+===================================================================
+--- src/base.h (.../tags/lighttpd-1.4.29)
++++ src/base.h (.../branches/lighttpd-1.4.x)
+@@ -277,6 +277,7 @@
+       buffer *ssl_cipher_list;
+       buffer *ssl_dh_file;
+       buffer *ssl_ec_curve;
++      unsigned short ssl_honor_cipher_order; /* determine SSL cipher in server-preferred order, not client-order */
+       unsigned short ssl_use_sslv2;
+       unsigned short ssl_use_sslv3;
+       unsigned short ssl_verifyclient;
+@@ -284,6 +285,7 @@
+       unsigned short ssl_verifyclient_depth;
+       buffer *ssl_verifyclient_username;
+       unsigned short ssl_verifyclient_export_cert;
++      unsigned short ssl_disable_client_renegotiation;
+       unsigned short use_ipv6, set_v6only; /* set_v6only is only a temporary option */
+       unsigned short defer_accept;
+@@ -437,6 +439,7 @@
+ # ifndef OPENSSL_NO_TLSEXT
+       buffer *tlsext_server_name;
+ # endif
++      unsigned int renegotiations; /* count of SSL_CB_HANDSHAKE_START */
+ #endif
+       /* etag handling */
+       etag_flags_t etag_flags;
+@@ -647,11 +650,9 @@
  
- #if 0
- static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const char *fn) {
--      if (buffer_is_empty(basedir) &&
--                      (fn[0] == '/' || fn[0] == '\\') &&
-+      if (buffer_is_empty(basedir) ||
-+                      (fn[0] == '/' || fn[0] == '\\') ||
-                       (fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) {
-               t->file = buffer_init_string(fn);
-       } else {
-@@ -884,8 +882,8 @@
-       int ret;
-       buffer *filename;
--      if (buffer_is_empty(context->basedir) &&
--                      (fn[0] == '/' || fn[0] == '\\') &&
-+      if (buffer_is_empty(context->basedir) ||
-+                      (fn[0] == '/' || fn[0] == '\\') ||
-                       (fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) {
-               filename = buffer_init_string(fn);
-       } else {
-@@ -912,15 +910,39 @@
-       return ret;
- }
+       fdevent_handler_t event_handler;
  
-+static char* getCWD() {
-+      char *s, *s1;
-+      size_t len;
-+#ifdef PATH_MAX
-+      len = PATH_MAX;
-+#else
-+      len = 4096;
-+#endif
-+
-+      s = malloc(len);
-+      if (!s) return NULL;
-+      while (NULL == getcwd(s, len)) {
-+              if (errno != ERANGE || SSIZE_MAX - len < len) return NULL;
-+              len *= 2;
-+              s1 = realloc(s, len);
-+              if (!s1) {
-+                      free(s);
-+                      return NULL;
-+              }
-+              s = s1;
-+      }
-+      return s;
-+}
-+
- int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
-       proc_handler_t proc;
-       tokenizer_t t;
-       int ret;
-       buffer *source;
-       buffer *out;
--      char oldpwd[PATH_MAX];
-+      char *oldpwd;
--      if (NULL == getcwd(oldpwd, sizeof(oldpwd))) {
-+      if (NULL == (oldpwd = getCWD())) {
-               log_error_write(srv, __FILE__, __LINE__, "s",
-                               "cannot get cwd", strerror(errno));
-               return -1;
-@@ -945,6 +967,7 @@
-       buffer_free(source);
-       buffer_free(out);
-       chdir(oldpwd);
-+      free(oldpwd);
-       return ret;
- }
+-      int (* network_backend_write)(struct server *srv, connection *con, int fd, chunkqueue *cq);
+-      int (* network_backend_read)(struct server *srv, connection *con, int fd, chunkqueue *cq);
++      int (* network_backend_write)(struct server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
+ #ifdef USE_OPENSSL
+-      int (* network_ssl_backend_write)(struct server *srv, connection *con, SSL *ssl, chunkqueue *cq);
+-      int (* network_ssl_backend_read)(struct server *srv, connection *con, SSL *ssl, chunkqueue *cq);
++      int (* network_ssl_backend_write)(struct server *srv, connection *con, SSL *ssl, chunkqueue *cq, off_t max_bytes);
+ #endif
  
-Index: src/lemon.c
+       uid_t uid;
+Index: src/connections.c
 ===================================================================
---- src/lemon.c        (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/lemon.c        (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -12,6 +12,19 @@
- #include <ctype.h>
- #include <stdlib.h>
+--- src/connections.c  (.../tags/lighttpd-1.4.29)
++++ src/connections.c  (.../branches/lighttpd-1.4.x)
+@@ -223,6 +223,12 @@
  
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#ifdef HAVE_STDINT_H
-+# include <stdint.h>
-+#endif
-+#ifdef HAVE_INTTYPES_H
-+# include <inttypes.h>
-+#endif
-+
-+#define UNUSED(x) ( (void)(x) )
-+
- extern void qsort();
- extern double strtod();
- extern long strtol();
-@@ -983,6 +996,7 @@
- {
-   struct symbol *spx, *spy;
-   int errcnt = 0;
-+  UNUSED(errsym);
-   assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */
-   if( apx->type==SHIFT && apy->type==REDUCE ){
-     spx = apx->sp;
-@@ -1347,6 +1361,7 @@
-   struct lemon lem;
-   char *def_tmpl_name = "lempar.c";
-+  UNUSED(argc);
-   OptInit(argv,options,stderr);
-   if( version ){
-      printf("Lemon version 1.0\n");
-@@ -1651,7 +1666,7 @@
-   }else if( op[j].type==OPT_FLAG ){
-     *((int*)op[j].arg) = v;
-   }else if( op[j].type==OPT_FFLAG ){
--    (*(void(*)())(op[j].arg))(v);
-+    (*(void(*)())(intptr_t)(op[j].arg))(v);
-   }else{
-     if( err ){
-       fprintf(err,"%smissing argument on switch.\n",emsg);
-@@ -1733,19 +1748,19 @@
-         *(double*)(op[j].arg) = dv;
-         break;
-       case OPT_FDBL:
--        (*(void(*)())(op[j].arg))(dv);
-+        (*(void(*)())(intptr_t)(op[j].arg))(dv);
-         break;
-       case OPT_INT:
-         *(int*)(op[j].arg) = lv;
-         break;
-       case OPT_FINT:
--        (*(void(*)())(op[j].arg))((int)lv);
-+        (*(void(*)())(intptr_t)(op[j].arg))((int)lv);
-         break;
-       case OPT_STR:
-         *(char**)(op[j].arg) = sv;
-         break;
-       case OPT_FSTR:
--        (*(void(*)())(op[j].arg))(sv);
-+        (*(void(*)())(intptr_t)(op[j].arg))(sv);
-         break;
-     }
-   }
-@@ -2286,10 +2301,10 @@
- ** token is passed to the function "parseonetoken" which builds all
- ** the appropriate data structures in the global state vector "gp".
- */
-+struct pstate ps;
- void Parse(gp)
- struct lemon *gp;
- {
--  struct pstate ps;
-   FILE *fp;
-   char *filebuf;
-   size_t filesize;
-Index: src/mod_scgi.c
-===================================================================
---- src/mod_scgi.c     (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_scgi.c     (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -202,6 +202,15 @@
-        *
-        */
+               len = SSL_read(con->ssl, b->ptr + read_offset, toread);
  
-+      /*
-+       * workaround for program when prefix="/"
-+       *
-+       * rule to build PATH_INFO is hardcoded for when check_local is disabled
-+       * enable this option to use the workaround
-+       *
-+       */
++              if (con->renegotiations > 1 && con->conf.ssl_disable_client_renegotiation) {
++                      connection_set_state(srv, con, CON_STATE_ERROR);
++                      log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client");
++                      return -1;
++              }
 +
-+      unsigned short fix_root_path_name;
-       ssize_t load; /* replace by host->load */
-       size_t max_id; /* corresponds most of the time to
-@@ -233,6 +242,7 @@
- typedef struct {
-       buffer *key; /* like .php */
-+      int note_is_sent;
-       scgi_extension_host **hosts;
-       size_t used;
-@@ -968,6 +978,7 @@
-                                               { "bin-environment",   NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },        /* 11 */
-                                               { "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },     /* 12 */
-+                                              { "fix-root-scriptname",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },   /* 13 */
+               if (len > 0) {
+                       if (b->used > 0) b->used--;
+                       b->used += len;
+@@ -445,6 +451,7 @@
+               default:
+                       switch(con->http_status) {
+                       case 400: /* bad request */
++                      case 401: /* authorization required */
+                       case 414: /* overload request header */
+                       case 505: /* unknown protocol */
+                       case 207: /* this was webdav */
+@@ -617,8 +624,9 @@
+ }
  
+ static int connection_handle_write(server *srv, connection *con) {
+-      switch(network_write_chunkqueue(srv, con, con->write_queue)) {
++      switch(network_write_chunkqueue(srv, con, con->write_queue, MAX_WRITE_LIMIT)) {
+       case 0:
++              con->write_request_ts = srv->cur_ts;
+               if (con->file_finished) {
+                       connection_set_state(srv, con, CON_STATE_RESPONSE_END);
+                       joblist_append(srv, con);
+@@ -635,6 +643,7 @@
+               joblist_append(srv, con);
+               break;
+       case 1:
++              con->write_request_ts = srv->cur_ts;
+               con->is_writable = 0;
+               /* not finished yet -> WRITE */
+@@ -1251,8 +1260,6 @@
+                       log_error_write(srv, __FILE__, __LINE__, "ds",
+                                       con->fd,
+                                       "handle write failed.");
+-              } else if (con->state == CON_STATE_WRITE) {
+-                      con->write_request_ts = srv->cur_ts;
+               }
+       }
  
-                                               { NULL,                NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
-@@ -990,6 +1001,7 @@
-                                       df->max_load_per_proc = 1;
-                                       df->idle_timeout = 60;
-                                       df->disable_time = 60;
-+                                      df->fix_root_path_name = 0;
+@@ -1352,6 +1359,7 @@
+                               return NULL;
+                       }
  
-                                       fcv[0].destination = df->host;
-                                       fcv[1].destination = df->docroot;
-@@ -1006,6 +1018,7 @@
++                      con->renegotiations = 0;
+ #ifndef OPENSSL_NO_TLSEXT
+                       SSL_set_app_data(con->ssl, con);
+ #endif
+@@ -1667,8 +1675,6 @@
+                                                       con->fd,
+                                                       "handle write failed.");
+                                       connection_set_state(srv, con, CON_STATE_ERROR);
+-                              } else if (con->state == CON_STATE_WRITE) {
+-                                      con->write_request_ts = srv->cur_ts;
+                               }
+                       }
  
-                                       fcv[11].destination = df->bin_env;
-                                       fcv[12].destination = df->bin_env_copy;
-+                                      fcv[13].destination = &(df->fix_root_path_name);
+Index: src/mod_staticfile.c
+===================================================================
+--- src/mod_staticfile.c       (.../tags/lighttpd-1.4.29)
++++ src/mod_staticfile.c       (.../branches/lighttpd-1.4.x)
+@@ -26,6 +26,7 @@
+ typedef struct {
+       array *exclude_ext;
+       unsigned short etags_used;
++      unsigned short disable_pathinfo;
+ } plugin_config;
  
+ typedef struct {
+@@ -84,6 +85,7 @@
+       config_values_t cv[] = {
+               { "static-file.exclude-extensions", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },       /* 0 */
+               { "static-file.etags",    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
++              { "static-file.disable-pathinfo", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
+               { NULL,                         NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
+       };
+@@ -97,9 +99,11 @@
+               s = calloc(1, sizeof(plugin_config));
+               s->exclude_ext    = array_init();
+               s->etags_used     = 1;
++              s->disable_pathinfo = 0;
+               cv[0].destination = s->exclude_ext;
+               cv[1].destination = &(s->etags_used);
++              cv[2].destination = &(s->disable_pathinfo);
+               p->config_storage[i] = s;
+@@ -119,6 +123,7 @@
+       PATCH(exclude_ext);
+       PATCH(etags_used);
++      PATCH(disable_pathinfo);
+       /* skip the first, the global context */
+       for (i = 1; i < srv->config_context->used; i++) {
+@@ -136,7 +141,9 @@
+                               PATCH(exclude_ext);
+                       } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.etags"))) {
+                               PATCH(etags_used);
+-                      } 
++                      } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("static-file.disable-pathinfo"))) {
++                              PATCH(disable_pathinfo);
++                      }
+               }
+       }
  
-                                       if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
-@@ -2668,10 +2681,10 @@
+@@ -350,7 +357,6 @@
+ URIHANDLER_FUNC(mod_staticfile_subrequest) {
        plugin_data *p = p_d;
-       size_t s_len;
-       int used = -1;
--      int ndx;
        size_t k;
-       buffer *fn;
-       scgi_extension *extension = NULL;
-+      scgi_extension_host *host = NULL;
+-      int s_len;
+       stat_cache_entry *sce = NULL;
+       buffer *mtime = NULL;
+       data_string *ds;
+@@ -376,7 +382,12 @@
  
-       /* Possibly, we processed already this request */
-       if (con->file_started == 1) return HANDLER_GO_ON;
-@@ -2712,95 +2725,59 @@
-       }
+       mod_staticfile_patch_connection(srv, con, p);
  
-       /* get best server */
--      for (k = 0, ndx = -1; k < extension->used; k++) {
--              scgi_extension_host *host = extension->hosts[k];
-+      for (k = 0; k < extension->used; k++) {
-+              scgi_extension_host *h = extension->hosts[k];
--              /* we should have at least one proc that can do somthing */
--              if (host->active_procs == 0) continue;
-+              /* we should have at least one proc that can do something */
-+              if (h->active_procs == 0) {
-+                      continue;
+-      s_len = con->uri.path->used - 1;
++      if (p->conf.disable_pathinfo && 0 != con->request.pathinfo->used) {
++              if (con->conf.log_request_handling) {
++                      log_error_write(srv, __FILE__, __LINE__,  "s",  "-- NOT handling file as static file, pathinfo forbidden");
 +              }
++              return HANDLER_GO_ON;
++      }
  
--              if (used == -1 || host->load < used) {
--                      used = host->load;
-+              if (used == -1 || h->load < used) {
-+                      used = h->load;
+       /* ignore certain extensions */
+       for (k = 0; k < p->conf.exclude_ext->used; k++) {
+Index: src/network.c
+===================================================================
+--- src/network.c      (.../tags/lighttpd-1.4.29)
++++ src/network.c      (.../branches/lighttpd-1.4.x)
+@@ -27,6 +27,19 @@
+ # include <openssl/rand.h>
+ #endif
  
--                      ndx = k;
-+                      host = h;
-               }
-       }
++#ifdef USE_OPENSSL
++static void ssl_info_callback(const SSL *ssl, int where, int ret) {
++      UNUSED(ret);
++
++      if (0 != (where & SSL_CB_HANDSHAKE_START)) {
++              connection *con = SSL_get_app_data(ssl);
++              ++con->renegotiations;
++      } else if (0 != (where & SSL_CB_HANDSHAKE_DONE)) {
++              ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
++      }
++}
++#endif
++
+ static handler_t network_server_handle_fdevent(server *srv, void *context, int revents) {
+       server_socket *srv_socket = (server_socket *)context;
+       connection *con;
+@@ -480,9 +493,11 @@
+       network_backend_t backend;
+ #if OPENSSL_VERSION_NUMBER >= 0x0090800fL
++#ifndef OPENSSL_NO_ECDH
+       EC_KEY *ecdh;
+       int nid;
+ #endif
++#endif
  
--      /* found a server */
--      if (ndx != -1) {
--              scgi_extension_host *host = extension->hosts[ndx];
-+      if (!host) {
-+              /* sorry, we don't have a server alive for this ext */
-+              buffer_reset(con->physical.path);
-+              con->http_status = 500;
--              /*
--               * if check-local is disabled, use the uri.path handler
--               *
--               */
-+              /* only send the 'no handler' once */
-+              if (!extension->note_is_sent) {
-+                      extension->note_is_sent = 1;
--              /* init handler-context */
--              if (uri_path_handler) {
--                      if (host->check_local == 0) {
--                              handler_ctx *hctx;
--                              char *pathinfo;
-+                      log_error_write(srv, __FILE__, __LINE__, "sbsbs",
-+                                      "all handlers for ", con->uri.path,
-+                                      "on", extension->key,
-+                                      "are down.");
-+              }
+ #ifdef USE_OPENSSL
+       DH *dh;
+@@ -553,6 +568,11 @@
+       /* load SSL certificates */
+       for (i = 0; i < srv->config_context->used; i++) {
+               specific_config *s = srv->config_storage[i];
++#ifndef SSL_OP_NO_COMPRESSION
++# define SSL_OP_NO_COMPRESSION 0
++#endif
++              long ssloptions =
++                      SSL_OP_ALL | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | SSL_OP_NO_COMPRESSION;
  
--                              hctx = handler_ctx_init();
-+              return HANDLER_FINISHED;
-+      }
+               if (buffer_is_empty(s->ssl_pemfile)) continue;
  
--                              hctx->remote_conn      = con;
--                              hctx->plugin_data      = p;
--                              hctx->host             = host;
--                              hctx->proc             = NULL;
-+      /* a note about no handler is not sent yet */
-+      extension->note_is_sent = 0;
--                              hctx->conf.exts        = p->conf.exts;
--                              hctx->conf.debug       = p->conf.debug;
-+      /*
-+       * if check-local is disabled, use the uri.path handler
-+       *
-+       */
--                              con->plugin_ctx[p->id] = hctx;
-+      /* init handler-context */
-+      if (uri_path_handler) {
-+              if (host->check_local == 0) {
-+                      handler_ctx *hctx;
-+                      char *pathinfo;
--                              host->load++;
--
--                              con->mode = p->id;
--
--                              if (con->conf.log_request_handling) {
--                                      log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_scgi");
--                              }
--
--                              /* the prefix is the SCRIPT_NAME,
--                               * everthing from start to the next slash
--                               * this is important for check-local = "disable"
--                               *
--                               * if prefix = /admin.fcgi
--                               *
--                               * /admin.fcgi/foo/bar
--                               *
--                               * SCRIPT_NAME = /admin.fcgi
--                               * PATH_INFO   = /foo/bar
--                               *
--                               * if prefix = /fcgi-bin/
--                               *
--                               * /fcgi-bin/foo/bar
--                               *
--                               * SCRIPT_NAME = /fcgi-bin/foo
--                               * PATH_INFO   = /bar
--                               *
--                               */
--
--                              /* the rewrite is only done for /prefix/? matches */
--                              if (extension->key->ptr[0] == '/' &&
--                                  con->uri.path->used > extension->key->used &&
--                                  NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
--                                      /* rewrite uri.path and pathinfo */
--
--                                      buffer_copy_string(con->request.pathinfo, pathinfo);
--
--                                      con->uri.path->used -= con->request.pathinfo->used - 1;
--                                      con->uri.path->ptr[con->uri.path->used - 1] = '\0';
--                              }
--                      }
--                      return HANDLER_GO_ON;
--              } else {
--                      handler_ctx *hctx;
-                       hctx = handler_ctx_init();
-                       hctx->remote_conn      = con;
-                       hctx->plugin_data      = p;
-                       hctx->host             = host;
--                      hctx->proc             = NULL;
-+                      hctx->proc             = NULL;
-                       hctx->conf.exts        = p->conf.exts;
-                       hctx->conf.debug       = p->conf.debug;
-@@ -2812,22 +2789,69 @@
-                       con->mode = p->id;
-                       if (con->conf.log_request_handling) {
--                              log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi");
-+                              log_error_write(srv, __FILE__, __LINE__, "s",
-+                              "handling it in mod_fastcgi");
-                       }
+@@ -586,6 +606,9 @@
+                       return -1;
+               }
  
--                      return HANDLER_GO_ON;
-+                      /* the prefix is the SCRIPT_NAME,
-+                       * everything from start to the next slash
-+                       * this is important for check-local = "disable"
-+                       *
-+                       * if prefix = /admin.fcgi
-+                       *
-+                       * /admin.fcgi/foo/bar
-+                       *
-+                       * SCRIPT_NAME = /admin.fcgi
-+                       * PATH_INFO   = /foo/bar
-+                       *
-+                       * if prefix = /fcgi-bin/
-+                       *
-+                       * /fcgi-bin/foo/bar
-+                       *
-+                       * SCRIPT_NAME = /fcgi-bin/foo
-+                       * PATH_INFO   = /bar
-+                       *
-+                       */
-+
-+                      /* the rewrite is only done for /prefix/? matches */
-+                      if (extension->key->ptr[0] == '/' &&
-+                          con->uri.path->used > extension->key->used &&
-+                          NULL != (pathinfo = strchr(con->uri.path->ptr + extension->key->used - 1, '/'))) {
-+                              /* rewrite uri.path and pathinfo */
++              SSL_CTX_set_options(s->ssl_ctx, ssloptions);
++              SSL_CTX_set_info_callback(s->ssl_ctx, ssl_info_callback);
 +
-+                              buffer_copy_string(con->request.pathinfo, pathinfo);
+               if (!s->ssl_use_sslv2) {
+                       /* disable SSLv2 */
+                       if (!(SSL_OP_NO_SSLv2 & SSL_CTX_set_options(s->ssl_ctx, SSL_OP_NO_SSLv2))) {
+@@ -611,6 +634,10 @@
+                                               ERR_error_string(ERR_get_error(), NULL));
+                               return -1;
+                       }
 +
-+                              con->uri.path->used -= con->request.pathinfo->used - 1;
-+                              con->uri.path->ptr[con->uri.path->used - 1] = '\0';
-+                      } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
-+                              buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
-+                              con->uri.path->used = 1;
-+                              con->uri.path->ptr[con->uri.path->used - 1] = '\0';
++                      if (s->ssl_honor_cipher_order) {
++                              SSL_CTX_set_options(s->ssl_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
 +                      }
                }
-       } else {
--              /* no handler found */
--              buffer_reset(con->physical.path);
--              con->http_status = 500;
-+              handler_ctx *hctx;
-+              hctx = handler_ctx_init();
--              log_error_write(srv, __FILE__, __LINE__,  "sb",
--                              "no fcgi-handler found for:",
--                              fn);
-+              hctx->remote_conn      = con;
-+              hctx->plugin_data      = p;
-+              hctx->host             = host;
-+              hctx->proc             = NULL;
--              return HANDLER_FINISHED;
-+              hctx->conf.exts        = p->conf.exts;
-+              hctx->conf.debug       = p->conf.debug;
-+
-+              con->plugin_ctx[p->id] = hctx;
-+
-+              host->load++;
+               /* Support for Diffie-Hellman key exchange */
+@@ -847,7 +874,7 @@
+       return 0;
+ }
+-int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq) {
++int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq, off_t max_bytes) {
+       int ret = -1;
+       off_t written = 0;
+ #ifdef TCP_CORK
+@@ -855,16 +882,34 @@
+ #endif
+       server_socket *srv_socket = con->srv_socket;
+-      if (con->conf.global_kbytes_per_second &&
+-          *(con->conf.global_bytes_per_second_cnt_ptr) > con->conf.global_kbytes_per_second * 1024) {
+-              /* we reached the global traffic limit */
++      if (con->conf.global_kbytes_per_second) {
++              off_t limit = con->conf.global_kbytes_per_second * 1024 - *(con->conf.global_bytes_per_second_cnt_ptr);
++              if (limit <= 0) {
++                      /* we reached the global traffic limit */
+-              con->traffic_limit_reached = 1;
+-              joblist_append(srv, con);
++                      con->traffic_limit_reached = 1;
++                      joblist_append(srv, con);
+-              return 1;
++                      return 1;
++              } else {
++                      if (max_bytes > limit) max_bytes = limit;
++              }
+       }
++      if (con->conf.kbytes_per_second) {
++              off_t limit = con->conf.kbytes_per_second * 1024 - con->bytes_written_cur_second;
++              if (limit <= 0) {
++                      /* we reached the traffic limit */
 +
-+              con->mode = p->id;
++                      con->traffic_limit_reached = 1;
++                      joblist_append(srv, con);
 +
-+              if (con->conf.log_request_handling) {
-+                      log_error_write(srv, __FILE__, __LINE__, "s", "handling it in mod_fastcgi");
++                      return 1;
++              } else {
++                      if (max_bytes > limit) max_bytes = limit;
 +              }
-       }
++      }
 +
-       return HANDLER_GO_ON;
- }
+       written = cq->bytes_out;
  
-Index: src/lighttpd-angel.c
-===================================================================
---- src/lighttpd-angel.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/lighttpd-angel.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -28,9 +28,12 @@
- static volatile sig_atomic_t graceful_restart = 0;
- static volatile pid_t pid = -1;
+ #ifdef TCP_CORK
+@@ -879,10 +924,10 @@
  
-+#define UNUSED(x) ( (void)(x) )
-+
- static void sigaction_handler(int sig, siginfo_t *si, void *context) {
-       int exitcode;
-+      UNUSED(context);
-       switch (sig) {
-       case SIGINT: 
-       case SIGTERM:
-@@ -60,6 +63,8 @@
-       int is_shutdown = 0;
-       struct sigaction act;
-+      UNUSED(argc);
-+
-       /**
-        * we are running as root BEWARE
-        */
-Index: src/mod_rrdtool.c
+       if (srv_socket->is_ssl) {
+ #ifdef USE_OPENSSL
+-              ret = srv->network_ssl_backend_write(srv, con, con->ssl, cq);
++              ret = srv->network_ssl_backend_write(srv, con, con->ssl, cq, max_bytes);
+ #endif
+       } else {
+-              ret = srv->network_backend_write(srv, con, con->fd, cq);
++              ret = srv->network_backend_write(srv, con, con->fd, cq, max_bytes);
+       }
+       if (ret >= 0) {
+@@ -903,12 +948,5 @@
+       *(con->conf.global_bytes_per_second_cnt_ptr) += written;
+-      if (con->conf.kbytes_per_second &&
+-          (con->bytes_written_cur_second > con->conf.kbytes_per_second * 1024)) {
+-              /* we reached the traffic limit */
+-
+-              con->traffic_limit_reached = 1;
+-              joblist_append(srv, con);
+-      }
+       return ret;
+ }
+Index: src/network.h
 ===================================================================
---- src/mod_rrdtool.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_rrdtool.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -148,6 +148,8 @@
-               args[i++] = dash;
-               args[i++] = NULL;
-+              openDevNull(STDERR_FILENO);
-+      
-               /* we don't need the client socket */
-               for (i = 3; i < 256; i++) {
-                       close(i);
-@@ -156,7 +158,7 @@
-               /* exec the cgi */
-               execv(args[0], args);
--              log_error_write(srv, __FILE__, __LINE__, "sss", "spawing rrdtool failed: ", strerror(errno), args[0]);
-+              /* log_error_write(srv, __FILE__, __LINE__, "sss", "spawing rrdtool failed: ", strerror(errno), args[0]); */
-               /* */
-               SEGFAULT();
-Index: src/response.c
+--- src/network.h      (.../tags/lighttpd-1.4.29)
++++ src/network.h      (.../branches/lighttpd-1.4.x)
+@@ -3,7 +3,7 @@
+ #include "server.h"
+-int network_write_chunkqueue(server *srv, connection *con, chunkqueue *c);
++int network_write_chunkqueue(server *srv, connection *con, chunkqueue *c, off_t max_bytes);
+ int network_init(server *srv);
+ int network_close(server *srv);
+Index: src/configfile.c
 ===================================================================
---- src/response.c     (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/response.c     (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -101,7 +101,7 @@
-       if (!have_server) {
-               if (buffer_is_empty(con->conf.server_tag)) {
-                       BUFFER_APPEND_STRING_CONST(b, "\r\nServer: " PACKAGE_NAME "/" PACKAGE_VERSION);
--              } else {
-+              } else if (con->conf.server_tag->used > 1) {
-                       BUFFER_APPEND_STRING_CONST(b, "\r\nServer: ");
-                       buffer_append_string_encoded(b, CONST_BUF_LEN(con->conf.server_tag), ENCODING_HTTP_HEADER);
+--- src/configfile.c   (.../tags/lighttpd-1.4.29)
++++ src/configfile.c   (.../branches/lighttpd-1.4.x)
+@@ -105,6 +105,8 @@
+               { "ssl.use-sslv3",               NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 62 */
+               { "ssl.dh-file",                 NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 63 */
+               { "ssl.ec-curve",                NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER },      /* 64 */
++              { "ssl.disable-client-renegotiation", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },/* 65 */
++              { "ssl.honor-cipher-order",      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER },     /* 66 */
+               { "server.host",                 "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
+               { "server.docroot",              "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
+@@ -176,6 +178,7 @@
+               s->max_write_idle = 360;
+               s->use_xattr     = 0;
+               s->is_ssl        = 0;
++              s->ssl_honor_cipher_order = 1;
+               s->ssl_use_sslv2 = 0;
+               s->ssl_use_sslv3 = 1;
+               s->use_ipv6      = 0;
+@@ -199,6 +202,7 @@
+               s->ssl_verifyclient_username = buffer_init();
+               s->ssl_verifyclient_depth = 9;
+               s->ssl_verifyclient_export_cert = 0;
++              s->ssl_disable_client_renegotiation = 1;
+               cv[2].destination = s->errorfile_prefix;
+@@ -245,6 +249,8 @@
+               cv[62].destination = &(s->ssl_use_sslv3);
+               cv[63].destination = s->ssl_dh_file;
+               cv[64].destination = s->ssl_ec_curve;
++              cv[66].destination = &(s->ssl_honor_cipher_order);
++
+               cv[49].destination = &(s->etag_use_inode);
+               cv[50].destination = &(s->etag_use_mtime);
+               cv[51].destination = &(s->etag_use_size);
+@@ -255,6 +261,7 @@
+               cv[58].destination = &(s->ssl_verifyclient_depth);
+               cv[59].destination = s->ssl_verifyclient_username;
+               cv[60].destination = &(s->ssl_verifyclient_export_cert);
++              cv[65].destination = &(s->ssl_disable_client_renegotiation);
+               srv->config_storage[i] = s;
+@@ -335,6 +342,7 @@
+       PATCH(ssl_cipher_list);
+       PATCH(ssl_dh_file);
+       PATCH(ssl_ec_curve);
++      PATCH(ssl_honor_cipher_order);
+       PATCH(ssl_use_sslv2);
+       PATCH(ssl_use_sslv3);
+       PATCH(etag_use_inode);
+@@ -346,6 +354,7 @@
+       PATCH(ssl_verifyclient_depth);
+       PATCH(ssl_verifyclient_username);
+       PATCH(ssl_verifyclient_export_cert);
++      PATCH(ssl_disable_client_renegotiation);
+       return 0;
+ }
+@@ -400,6 +409,8 @@
+ #endif
+                       } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.ca-file"))) {
+                               PATCH(ssl_ca_file);
++                      } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.honor-cipher-order"))) {
++                              PATCH(ssl_honor_cipher_order);
+                       } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.use-sslv2"))) {
+                               PATCH(ssl_use_sslv2);
+                       } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.use-sslv3"))) {
+@@ -454,6 +465,8 @@
+                               PATCH(ssl_verifyclient_username);
+                       } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.verifyclient.exportcert"))) {
+                               PATCH(ssl_verifyclient_export_cert);
++                      } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.disable-client-renegotiation"))) {
++                              PATCH(ssl_disable_client_renegotiation);
+                       }
                }
-@@ -152,7 +152,7 @@
-                *  */
+       }
+Index: src/mod_scgi.c
+===================================================================
+--- src/mod_scgi.c     (.../tags/lighttpd-1.4.29)
++++ src/mod_scgi.c     (.../branches/lighttpd-1.4.x)
+@@ -2296,7 +2296,7 @@
+               /* fall through */
+       case FCGI_STATE_WRITE:
+-              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb);
++              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb, MAX_WRITE_LIMIT);
  
-               config_cond_cache_reset(srv, con);
--              config_setup_connection(srv, con); // Perhaps this could be removed at other places.
-+              config_setup_connection(srv, con); /* Perhaps this could be removed at other places. */
+               chunkqueue_remove_finished_chunks(hctx->wb);
  
-               if (con->conf.log_condition_handling) {
-                       log_error_write(srv, __FILE__, __LINE__,  "s",  "run condition");
-Index: src/plugin.c
+Index: src/request.c
 ===================================================================
---- src/plugin.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/plugin.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -197,7 +197,7 @@
+--- src/request.c      (.../tags/lighttpd-1.4.29)
++++ src/request.c      (.../branches/lighttpd-1.4.x)
+@@ -49,7 +49,7 @@
+                               if (++colon_cnt > 7) {
+                                       return -1;
+                               }
+-                      } else if (!light_isxdigit(*c)) {
++                      } else if (!light_isxdigit(*c) && '.' != *c) {
+                               return -1;
+                       }
+               }
+Index: src/network_backends.h
+===================================================================
+--- src/network_backends.h     (.../tags/lighttpd-1.4.29)
++++ src/network_backends.h     (.../branches/lighttpd-1.4.x)
+@@ -47,18 +47,18 @@
+ #include "base.h"
+ /* return values:
+- * >= 0 : chunks completed
++ * >= 0 : no error
+  *   -1 : error (on our side)
+  *   -2 : remote close
+  */
+-int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq);
+-int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkqueue *cq);
+-int network_write_chunkqueue_linuxsendfile(server *srv, connection *con, int fd, chunkqueue *cq);
+-int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int fd, chunkqueue *cq);
+-int network_write_chunkqueue_solarissendfilev(server *srv, connection *con, int fd, chunkqueue *cq);
++int network_write_chunkqueue_write(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
++int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
++int network_write_chunkqueue_linuxsendfile(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
++int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
++int network_write_chunkqueue_solarissendfilev(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes);
+ #ifdef USE_OPENSSL
+-int network_write_chunkqueue_openssl(server *srv, connection *con, SSL *ssl, chunkqueue *cq);
++int network_write_chunkqueue_openssl(server *srv, connection *con, SSL *ssl, chunkqueue *cq, off_t max_bytes);
+ #endif
  
- #else
- #if 1
--              init = (int (*)(plugin *))dlsym(p->lib, srv->tmp_buf->ptr);
-+              init = (int (*)(plugin *))(intptr_t)dlsym(p->lib, srv->tmp_buf->ptr);
- #else
-               *(void **)(&init) = dlsym(p->lib, srv->tmp_buf->ptr);
  #endif
 Index: src/SConscript
 ===================================================================
---- src/SConscript     (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/SConscript     (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -43,6 +43,7 @@
-       'mod_cgi' : { 'src' : [ 'mod_cgi.c' ] },
-       'mod_fastcgi' : { 'src' : [ 'mod_fastcgi.c' ] },
-       'mod_scgi' : { 'src' : [ 'mod_scgi.c' ] },
-+      'mod_extforward' : { 'src' : [ 'mod_extforward.c' ] },
-       'mod_staticfile' : { 'src' : [ 'mod_staticfile.c' ] },
-       'mod_dirlisting' : { 'src' : [ 'mod_dirlisting.c' ], 'lib' : [ env['LIBPCRE'] ] },
-       'mod_indexfile' : { 'src' : [ 'mod_indexfile.c' ] },
-Index: src/mod_extforward.c
+--- src/SConscript     (.../tags/lighttpd-1.4.29)
++++ src/SConscript     (.../branches/lighttpd-1.4.x)
+@@ -12,7 +12,8 @@
+       data_integer.c md5.c data_fastcgi.c \
+       fdevent_select.c fdevent_libev.c \
+       fdevent_poll.c fdevent_linux_sysepoll.c \
+-      fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c \
++      fdevent_solaris_devpoll.c fdevent_solaris_port.c \
++      fdevent_freebsd_kqueue.c \
+       data_config.c bitset.c \
+       inet_ntop_cache.c crc32.c \
+       connections-glue.c \
+@@ -62,7 +63,7 @@
+       'mod_redirect' : { 'src' : [ 'mod_redirect.c' ], 'lib' : [ env['LIBPCRE'] ] },
+       'mod_rewrite' : { 'src' : [ 'mod_rewrite.c' ], 'lib' : [ env['LIBPCRE'] ] },
+       'mod_auth' : {
+-              'src' : [ 'mod_auth.c', 'http_auth_digest.c', 'http_auth.c' ],
++              'src' : [ 'mod_auth.c', 'http_auth.c' ],
+               'lib' : [ env['LIBCRYPT'], env['LIBLDAP'], env['LIBLBER'] ] },
+       'mod_webdav' : { 'src' : [ 'mod_webdav.c' ], 'lib' : [ env['LIBXML2'], env['LIBSQLITE3'], env['LIBUUID'] ] },
+       'mod_mysql_vhost' : { 'src' : [ 'mod_mysql_vhost.c' ], 'lib' : [ env['LIBMYSQL'] ] },
+Index: src/mod_cml_funcs.c
 ===================================================================
---- src/mod_extforward.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_extforward.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -281,8 +281,9 @@
- static const char *last_not_in_array(array *a, plugin_data *p)
- {
-       array *forwarder = p->conf.forwarder;
-+      int i;
+--- src/mod_cml_funcs.c        (.../tags/lighttpd-1.4.29)
++++ src/mod_cml_funcs.c        (.../branches/lighttpd-1.4.x)
+@@ -17,18 +17,8 @@
+ #include <dirent.h>
+ #include <stdio.h>
  
--      for (int i = a->used - 1; i >= 0; i--) {
-+      for (i = a->used - 1; i >= 0; i--) {
-               data_string *ds = (data_string *)a->data[i];
-               const char *ip = ds->value->ptr;
+-#ifdef USE_OPENSSL
+-# include <openssl/md5.h>
+-#else
+-# include "md5.h"
++#include "md5.h"
  
-Index: src/Makefile.am
-===================================================================
---- src/Makefile.am    (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/Makefile.am    (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -16,20 +16,17 @@
- configparser.c configparser.h:
- mod_ssi_exprparser.c mod_ssi_exprparser.h:
- else
--$(srcdir)/configparser.y: lemon
--$(srcdir)/mod_ssi_exprparser.y: lemon
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
 -
--configparser.c configparser.h: $(srcdir)/configparser.y
-+configparser.c configparser.h: lemon $(srcdir)/configparser.y $(srcdir)/lempar.c
-       rm -f configparser.h
-       $(LEMON) -q $(srcdir)/configparser.y $(srcdir)/lempar.c
--mod_ssi_exprparser.c mod_ssi_exprparser.h: $(srcdir)/mod_ssi_exprparser.y
-+mod_ssi_exprparser.c mod_ssi_exprparser.h: lemon $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
-       rm -f mod_ssi_exprparser.h
-       $(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c
- endif
--$(srcdir)/configfile.c: configparser.h
--$(srcdir)/mod_ssi_expr.c: mod_ssi_exprparser.h
-+configfile.o: configparser.h
-+mod_ssi_expr.o: mod_ssi_exprparser.h
- common_src=buffer.c log.c \
-       keyvalue.c chunk.c  \
-Index: src/network_openssl.c
+-#endif
+-
+ #define HASHLEN 16
+ typedef unsigned char HASH[HASHLEN];
+ #define HASHHEXLEN 32
+@@ -43,7 +33,7 @@
+ #ifdef HAVE_LUA_H
+ int f_crypto_md5(lua_State *L) {
+-      MD5_CTX Md5Ctx;
++      li_MD5_CTX Md5Ctx;
+       HASH HA1;
+       buffer b;
+       char hex[33];
+@@ -63,9 +53,9 @@
+               lua_error(L);
+       }
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)lua_tostring(L, 1), lua_strlen(L, 1));
+-      MD5_Final(HA1, &Md5Ctx);
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)lua_tostring(L, 1), lua_strlen(L, 1));
++      li_MD5_Final(HA1, &Md5Ctx);
+       buffer_copy_string_hex(&b, (char *)HA1, 16);
+Index: src/mod_userdir.c
 ===================================================================
---- src/network_openssl.c      (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/network_openssl.c      (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -85,6 +85,7 @@
-                        *
-                        */
+--- src/mod_userdir.c  (.../tags/lighttpd-1.4.29)
++++ src/mod_userdir.c  (.../branches/lighttpd-1.4.x)
+@@ -166,7 +166,6 @@
  
-+                      ERR_clear_error();
-                       if ((r = SSL_write(ssl, offset, toSend)) <= 0) {
-                               unsigned long err;
+ URIHANDLER_FUNC(mod_userdir_docroot_handler) {
+       plugin_data *p = p_d;
+-      int uri_len;
+       size_t k;
+       char *rel_url;
+ #ifdef HAVE_PWD_H
+@@ -182,8 +181,6 @@
+        */
+       if (p->conf.path->used == 0) return HANDLER_GO_ON;
  
-@@ -187,6 +188,7 @@
+-      uri_len = con->uri.path->used - 1;
+-
+       /* /~user/foo.html -> /home/user/public_html/foo.html */
  
-                               close(ifd);
+       if (con->uri.path->ptr[0] != '/' ||
+Index: src/mod_proxy.c
+===================================================================
+--- src/mod_proxy.c    (.../tags/lighttpd-1.4.29)
++++ src/mod_proxy.c    (.../branches/lighttpd-1.4.x)
+@@ -825,7 +825,7 @@
  
-+                              ERR_clear_error();
-                               if ((r = SSL_write(ssl, s, toSend)) <= 0) {
-                                       unsigned long err;
+               /* fall through */
+       case PROXY_STATE_WRITE:;
+-              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb);
++              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb, MAX_WRITE_LIMIT);
+               chunkqueue_remove_finished_chunks(hctx->wb);
  
-Index: src/mod_redirect.c
+Index: src/Makefile.am
 ===================================================================
---- src/mod_redirect.c (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_redirect.c (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -215,8 +215,7 @@
-                       start = 0; end = pattern_len;
-                       for (k = 0; k < pattern_len; k++) {
--                              if ((pattern[k] == '$' || pattern[k] == '%') &&
--                                  isdigit((unsigned char)pattern[k + 1])) {
-+                              if (pattern[k] == '$' || pattern[k] == '%') {
-                                       /* got one */
-                                       size_t num = pattern[k + 1] - '0';
-@@ -225,7 +224,10 @@
-                                       buffer_append_string_len(p->location, pattern + start, end - start);
--                                      if (pattern[k] == '$') {
-+                                      if (!isdigit((unsigned char)pattern[k + 1])) {
-+                                              /* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */
-+                                              buffer_append_string_len(p->location, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2);
-+                                      } else if (pattern[k] == '$') {
-                                               /* n is always > 0 */
-                                               if (num < (size_t)n) {
-                                                       buffer_append_string(p->location, list[num]);
-Index: src/mod_webdav.c
+--- src/Makefile.am    (.../tags/lighttpd-1.4.29)
++++ src/Makefile.am    (.../branches/lighttpd-1.4.x)
+@@ -241,7 +241,7 @@
+ mod_compress_la_LIBADD = $(Z_LIB) $(BZ_LIB) $(common_libadd)
+ lib_LTLIBRARIES += mod_auth.la
+-mod_auth_la_SOURCES = mod_auth.c http_auth_digest.c http_auth.c
++mod_auth_la_SOURCES = mod_auth.c http_auth.c
+ mod_auth_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
+ mod_auth_la_LIBADD = $(CRYPT_LIB) $(LDAP_LIB) $(LBER_LIB) $(common_libadd)
+@@ -268,7 +268,7 @@
+ hdr = server.h buffer.h network.h log.h keyvalue.h \
+       response.h request.h fastcgi.h chunk.h \
+-      settings.h http_chunk.h http_auth_digest.h \
++      settings.h http_chunk.h \
+       md5.h http_auth.h stream.h \
+       fdevent.h connections.h base.h stat_cache.h \
+       plugin.h mod_auth.h \
+Index: src/network_writev.c
 ===================================================================
---- src/mod_webdav.c   (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_webdav.c   (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -570,6 +570,8 @@
-                               /* */
-                       }
-               }
-+#else
-+              UNUSED(p);
+--- src/network_writev.c       (.../tags/lighttpd-1.4.29)
++++ src/network_writev.c       (.../branches/lighttpd-1.4.x)
+@@ -30,17 +30,16 @@
+ #define LOCAL_BUFFERING 1
  #endif
-       }
  
-@@ -730,6 +732,8 @@
-                       }
-               }
-       }
-+#else
-+      UNUSED(p);
+-int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkqueue *cq) {
++int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes) {
+       chunk *c;
+-      size_t chunks_written = 0;
+-      for(c = cq->first; c; c = c->next) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
+                       size_t num_chunks, i;
+@@ -65,12 +64,10 @@
+ #error "sysconf() doesnt return _SC_IOV_MAX ..., check the output of 'man writev' for the EINVAL error and send the output to jan@kneschke.de"
  #endif
-       return status;
- }
-@@ -1154,6 +1158,7 @@
-       int has_lock = 1;
  
- #ifdef USE_LOCKS
-+      UNUSED(srv);
-       data_string *ds;
+-                      /* we can't send more then SSIZE_MAX bytes in one chunk */
+-
+                       /* build writev list
+                        *
+                        * 1. limit: num_chunks < max_chunks
+-                       * 2. limit: num_bytes < SSIZE_MAX
++                       * 2. limit: num_bytes < max_bytes
+                        */
+                       for (num_chunks = 0, tc = c; tc && tc->type == MEM_CHUNK && num_chunks < max_chunks; num_chunks++, tc = tc->next);
+@@ -87,9 +84,9 @@
+                                       chunks[i].iov_base = offset;
+                                       /* protect the return value of writev() */
+-                                      if (toSend > SSIZE_MAX ||
+-                                          num_bytes + toSend > SSIZE_MAX) {
+-                                              chunks[i].iov_len = SSIZE_MAX - num_bytes;
++                                      if (toSend > max_bytes ||
++                                          (off_t) num_bytes + toSend > max_bytes) {
++                                              chunks[i].iov_len = max_bytes - num_bytes;
+                                               num_chunks = i + 1;
+                                               break;
+@@ -121,6 +118,7 @@
+                       }
  
-       /**
-@@ -1192,6 +1197,11 @@
-                       has_lock = 0;
-               }
-       }
-+#else
-+      UNUSED(srv);
-+      UNUSED(con);
-+      UNUSED(p);
-+      UNUSED(uri);
- #endif
+                       cq->bytes_out += r;
++                      max_bytes -= r;
  
-       return has_lock;
-Index: src/md5.c
-===================================================================
---- src/md5.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/md5.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -52,9 +52,9 @@
- #define S43 15
- #define S44 21
--static void MD5Transform (UINT4 [4], unsigned char [64]);
-+static void MD5Transform (UINT4 [4], const unsigned char [64]);
- static void Encode (unsigned char *, UINT4 *, unsigned int);
--static void Decode (UINT4 *, unsigned char *, unsigned int);
-+static void Decode (UINT4 *, const unsigned char *, unsigned int);
- #ifdef HAVE_MEMCPY
- #define MD5_memcpy(output, input, len) memcpy((output), (input), (len))
-@@ -126,12 +126,13 @@
-   operation, processing another message block, and updating the
-   context.
-  */
--void MD5_Update (context, input, inputLen)
-+void MD5_Update (context, _input, inputLen)
- MD5_CTX *context;                                        /* context */
--unsigned char *input;                                /* input block */
-+const void *_input;                                /* input block */
- unsigned int inputLen;                     /* length of input block */
- {
-   unsigned int i, ndx, partLen;
-+  const unsigned char *input = (const unsigned char*) _input;
+                       /* check which chunks have been written */
  
-   /* Compute number of bytes mod 64 */
-   ndx = (unsigned int)((context->count[0] >> 3) & 0x3F);
-@@ -200,7 +201,7 @@
-  */
- static void MD5Transform (state, block)
- UINT4 state[4];
--unsigned char block[64];
-+const unsigned char block[64];
- {
-   UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+@@ -132,11 +130,10 @@
  
-@@ -313,7 +314,7 @@
-  */
- static void Decode (output, input, len)
- UINT4 *output;
--unsigned char *input;
-+const unsigned char *input;
- unsigned int len;
- {
-   unsigned int i, j;
-Index: src/mod_compress.c
-===================================================================
---- src/mod_compress.c (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_compress.c (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -102,7 +102,7 @@
-       return HANDLER_GO_ON;
- }
+                                       if (chunk_finished) {
+                                               /* skip the chunks from further touches */
+-                                              chunks_written++;
+                                               c = c->next;
+                                       } else {
+                                               /* chunks_written + c = c->next is done in the for()*/
+-                                              chunk_finished++;
++                                              chunk_finished = 1;
+                                       }
+                               } else {
+                                       /* partially written */
+@@ -284,6 +281,8 @@
+                               assert(toSend < 0);
+                       }
  
--// 0 on success, -1 for error
-+/* 0 on success, -1 for error */
- int mkdir_recursive(char *dir) {
-       char *p = dir;
++                      if (toSend > max_bytes) toSend = max_bytes;
++
+ #ifdef LOCAL_BUFFERING
+                       start = c->mem->ptr;
+ #else
+@@ -309,6 +308,7 @@
  
-@@ -118,13 +118,13 @@
-               }
+                       c->offset += r;
+                       cq->bytes_out += r;
++                      max_bytes -= r;
+                       if (c->offset == c->file.length) {
+                               chunk_finished = 1;
+@@ -334,11 +334,9 @@
  
-               *p++ = '/';
--              if (!*p) return 0; // Ignore trailing slash
-+              if (!*p) return 0; /* Ignore trailing slash */
+                       break;
+               }
+-
+-              chunks_written++;
        }
  
-       return (mkdir(dir, 0700) != 0) && (errno != EEXIST) ? -1 : 0;
+-      return chunks_written;
++      return 0;
  }
  
--// 0 on success, -1 for error
-+/* 0 on success, -1 for error */
- int mkdir_for_file(char *filename) {
-       char *p = filename;
+ #endif
+Index: src/network_freebsd_sendfile.c
+===================================================================
+--- src/network_freebsd_sendfile.c     (.../tags/lighttpd-1.4.29)
++++ src/network_freebsd_sendfile.c     (.../branches/lighttpd-1.4.x)
+@@ -31,17 +31,16 @@
+ # endif
+ #endif
  
-@@ -140,7 +140,7 @@
-               }
+-int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int fd, chunkqueue *cq) {
++int network_write_chunkqueue_freebsdsendfile(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes) {
+       chunk *c;
+-      size_t chunks_written = 0;
  
-               *p++ = '/';
--              if (!*p) return -1; // Unexpected trailing slash in filename
-+              if (!*p) return -1; /* Unexpected trailing slash in filename */
-       }
+-      for(c = cq->first; c; c = c->next, chunks_written++) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
  
-       return 0;
-@@ -178,9 +178,9 @@
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
+                       size_t num_chunks, i;
+@@ -49,12 +48,10 @@
+                       chunk *tc;
+                       size_t num_bytes = 0;
+-                      /* we can't send more then SSIZE_MAX bytes in one chunk */
+-
+                       /* build writev list
+                        *
+                        * 1. limit: num_chunks < UIO_MAXIOV
+-                       * 2. limit: num_bytes < SSIZE_MAX
++                       * 2. limit: num_bytes < max_bytes
+                        */
+                       for(num_chunks = 0, tc = c; tc && tc->type == MEM_CHUNK && num_chunks < UIO_MAXIOV; num_chunks++, tc = tc->next);
+@@ -69,9 +66,9 @@
+                                       chunks[i].iov_base = offset;
+                                       /* protect the return value of writev() */
+-                                      if (toSend > SSIZE_MAX ||
+-                                          num_bytes + toSend > SSIZE_MAX) {
+-                                              chunks[i].iov_len = SSIZE_MAX - num_bytes;
++                                      if (toSend > max_bytes ||
++                                          (off_t) num_bytes + toSend > max_bytes) {
++                                              chunks[i].iov_len = max_bytes - num_bytes;
+                                               num_chunks = i + 1;
+                                               break;
+@@ -105,6 +102,7 @@
+                       /* check which chunks have been written */
+                       cq->bytes_out += r;
++                      max_bytes -= r;
+                       for(i = 0, tc = c; i < num_chunks; i++, tc = tc->next) {
+                               if (r >= (ssize_t)chunks[i].iov_len) {
+@@ -114,11 +112,10 @@
+                                       if (chunk_finished) {
+                                               /* skip the chunks from further touches */
+-                                              chunks_written++;
+                                               c = c->next;
+                                       } else {
+                                               /* chunks_written + c = c->next is done in the for()*/
+-                                              chunk_finished++;
++                                              chunk_finished = 1;
+                                       }
+                               } else {
+                                       /* partially written */
+@@ -134,7 +131,7 @@
                }
+               case FILE_CHUNK: {
+                       off_t offset, r;
+-                      size_t toSend;
++                      off_t toSend;
+                       stat_cache_entry *sce = NULL;
  
-               if (!buffer_is_empty(s->compress_cache_dir)) {
-+                      struct stat st;
-                       mkdir_recursive(s->compress_cache_dir->ptr);
+                       if (HANDLER_ERROR == stat_cache_get_entry(srv, con, c->file.name, &sce)) {
+@@ -144,9 +141,8 @@
+                       }
  
--                      struct stat st;
-                       if (0 != stat(s->compress_cache_dir->ptr, &st)) {
-                               log_error_write(srv, __FILE__, __LINE__, "sbs", "can't stat compress.cache-dir",
-                                               s->compress_cache_dir, strerror(errno));
-Index: src/md5.h
-===================================================================
---- src/md5.h  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/md5.h  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -42,6 +42,6 @@
- } MD5_CTX;
+                       offset = c->file.start + c->offset;
+-                      /* limit the toSend to 2^31-1 bytes in a chunk */
+-                      toSend = c->file.length - c->offset > ((1 << 30) - 1) ?
+-                              ((1 << 30) - 1) : c->file.length - c->offset;
++                      toSend = c->file.length - c->offset;
++                      if (toSend > max_bytes) toSend = max_bytes;
  
- void MD5_Init (MD5_CTX *);
--void MD5_Update (MD5_CTX *, unsigned char *, unsigned int);
-+void MD5_Update (MD5_CTX *, const void *, unsigned int);
- void MD5_Final (unsigned char [16], MD5_CTX *);
+                       if (-1 == c->file.fd) {
+                               if (-1 == (c->file.fd = open(c->file.name->ptr, O_RDONLY))) {
+@@ -197,6 +193,7 @@
  
-Index: src/mod_auth.c
-===================================================================
---- src/mod_auth.c     (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_auth.c     (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -519,85 +519,86 @@
- handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s) {
- #ifdef USE_LDAP
--                      int ret;
-+      int ret;
- #if 0
--                      if (s->auth_ldap_basedn->used == 0) {
--                              log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set");
-+      if (s->auth_ldap_basedn->used == 0) {
-+              log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set");
--                              return HANDLER_ERROR;
--                      }
-+              return HANDLER_ERROR;
-+      }
- #endif
+                       c->offset += r;
+                       cq->bytes_out += r;
++                      max_bytes -= r;
  
--                      if (s->auth_ldap_filter->used) {
--                              char *dollar;
-+      if (s->auth_ldap_filter->used) {
-+              char *dollar;
+                       if (c->offset == c->file.length) {
+                               chunk_finished = 1;
+@@ -218,7 +215,7 @@
+               }
+       }
  
--                              /* parse filter */
-+              /* parse filter */
+-      return chunks_written;
++      return 0;
+ }
  
--                              if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) {
--                                      log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'");
-+              if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) {
-+                      log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'");
+ #endif
+Index: src/network_openssl.c
+===================================================================
+--- src/network_openssl.c      (.../tags/lighttpd-1.4.29)
++++ src/network_openssl.c      (.../branches/lighttpd-1.4.x)
+@@ -27,10 +27,9 @@
+ # include <openssl/ssl.h>
+ # include <openssl/err.h>
+-int network_write_chunkqueue_openssl(server *srv, connection *con, SSL *ssl, chunkqueue *cq) {
++int network_write_chunkqueue_openssl(server *srv, connection *con, SSL *ssl, chunkqueue *cq, off_t max_bytes) {
+       int ssl_r;
+       chunk *c;
+-      size_t chunks_written = 0;
+       /* this is a 64k sendbuffer
+        *
+@@ -59,13 +58,13 @@
+               SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN);
+       }
  
--                                      return HANDLER_ERROR;
--                              }
-+                      return HANDLER_ERROR;
-+              }
+-      for(c = cq->first; c; c = c->next) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
  
--                              buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr);
--                              buffer_copy_string(s->ldap_filter_post, dollar+1);
--                      }
-+              buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr);
-+              buffer_copy_string(s->ldap_filter_post, dollar+1);
-+      }
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
  
--                      if (s->auth_ldap_hostname->used) {
--                              if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) {
--                                      log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
-+      if (s->auth_ldap_hostname->used) {
-+              if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) {
-+                      log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno));
+                       if (c->mem->used == 0 || c->mem->used == 1) {
+@@ -75,6 +74,7 @@
  
--                                      return HANDLER_ERROR;
--                              }
-+                      return HANDLER_ERROR;
-+              }
+                       offset = c->mem->ptr + c->offset;
+                       toSend = c->mem->used - 1 - c->offset;
++                      if (toSend > max_bytes) toSend = max_bytes;
  
--                              ret = LDAP_VERSION3;
--                              if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) {
--                                      log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
-+              ret = LDAP_VERSION3;
-+              if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) {
-+                      log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
+                       /**
+                        * SSL_write man-page
+@@ -87,7 +87,14 @@
+                        */
  
-+                      return HANDLER_ERROR;
-+              }
+                       ERR_clear_error();
+-                      if ((r = SSL_write(ssl, offset, toSend)) <= 0) {
++                      r = SSL_write(ssl, offset, toSend);
 +
-+              if (s->auth_ldap_starttls) {
-+                      /* if no CA file is given, it is ok, as we will use encryption
-+                              * if the server requires a CAfile it will tell us */
-+                      if (!buffer_is_empty(s->auth_ldap_cafile)) {
-+                              if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE,
-+                                                              s->auth_ldap_cafile->ptr))) {
-+                                      log_error_write(srv, __FILE__, __LINE__, "ss",
-+                                                      "Loading CA certificate failed:", ldap_err2string(ret));
-+
-                                       return HANDLER_ERROR;
-                               }
-+                      }
--                              if (s->auth_ldap_starttls) {
--                                      /* if no CA file is given, it is ok, as we will use encryption
--                                       * if the server requires a CAfile it will tell us */
--                                      if (!buffer_is_empty(s->auth_ldap_cafile)) {
--                                              if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE,
--                                                                              s->auth_ldap_cafile->ptr))) {
--                                                      log_error_write(srv, __FILE__, __LINE__, "ss",
--                                                                      "Loading CA certificate failed:", ldap_err2string(ret));
-+                      if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) {
-+                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret));
--                                                      return HANDLER_ERROR;
--                                              }
--                                      }
-+                              return HANDLER_ERROR;
++                      if (con->renegotiations > 1 && con->conf.ssl_disable_client_renegotiation) {
++                              log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client");
++                              return -1;
 +                      }
-+              }
++
++                      if (r <= 0) {
+                               unsigned long err;
  
--                                      if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) {
--                                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret));
+                               switch ((ssl_r = SSL_get_error(ssl, r))) {
+@@ -139,6 +146,7 @@
+                       } else {
+                               c->offset += r;
+                               cq->bytes_out += r;
++                              max_bytes -= r;
+                       }
  
--                                              return HANDLER_ERROR;
--                                      }
--                              }
-+              /* 1. */
-+              if (s->auth_ldap_binddn->used) {
-+                      if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) {
-+                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
+                       if (c->offset == (off_t)c->mem->used - 1) {
+@@ -168,6 +176,7 @@
+                       do {
+                               off_t offset = c->file.start + c->offset;
+                               off_t toSend = c->file.length - c->offset;
++                              if (toSend > max_bytes) toSend = max_bytes;
  
-+                              return HANDLER_ERROR;
-+                      }
-+              } else {
-+                      if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) {
-+                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
+                               if (toSend > LOCAL_SEND_BUFSIZE) toSend = LOCAL_SEND_BUFSIZE;
  
--                              /* 1. */
--                              if (s->auth_ldap_binddn->used) {
--                                      if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) {
--                                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
--
--                                              return HANDLER_ERROR;
--                                      }
--                              } else {
--                                      if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) {
--                                              log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret));
--
--                                              return HANDLER_ERROR;
--                                      }
--                              }
-+                              return HANDLER_ERROR;
-                       }
-+              }
-+      }
-+      return HANDLER_GO_ON;
- #else
--                      log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available");
--                      return HANDLER_ERROR;
-+      UNUSED(s);
-+      log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available");
-+      return HANDLER_ERROR;
- #endif
--              return HANDLER_GO_ON;
- }
+@@ -190,7 +199,14 @@
+                               close(ifd);
  
- int mod_auth_plugin_init(plugin *p) {
-Index: src/mod_fastcgi.c
-===================================================================
---- src/mod_fastcgi.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_fastcgi.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -236,6 +236,16 @@
-       unsigned short break_scriptfilename_for_php;
-       /*
-+       * workaround for program when prefix="/"
-+       *
-+       * rule to build PATH_INFO is hardcoded for when check_local is disabled
-+       * enable this option to use the workaround
-+       *
-+       */
+                               ERR_clear_error();
+-                              if ((r = SSL_write(ssl, s, toSend)) <= 0) {
++                              r = SSL_write(ssl, s, toSend);
 +
-+      unsigned short fix_root_path_name;
++                              if (con->renegotiations > 1 && con->conf.ssl_disable_client_renegotiation) {
++                                      log_error_write(srv, __FILE__, __LINE__, "s", "SSL: renegotiation initiated by client");
++                                      return -1;
++                              }
 +
-+      /*
-        * If the backend includes X-LIGHTTPD-send-file in the response
-        * we use the value as filename and ignore the content.
-        *
-@@ -937,6 +947,8 @@
-                               close(fcgi_fd);
-                       }
++                              if (r <= 0) {
+                                       unsigned long err;
  
-+                      openDevNull(STDERR_FILENO);
-+
-                       /* we don't need the client socket */
-                       for (i = 3; i < 256; i++) {
-                               close(i);
-@@ -1000,8 +1012,8 @@
-                       /* exec the cgi */
-                       execve(arg.ptr[0], arg.ptr, env.ptr);
--                      log_error_write(srv, __FILE__, __LINE__, "sbs",
--                                      "execve failed for:", host->bin_path, strerror(errno));
-+                      /* log_error_write(srv, __FILE__, __LINE__, "sbs",
-+                                      "execve failed for:", host->bin_path, strerror(errno)); */
-                       exit(errno);
-@@ -1193,6 +1205,7 @@
-                                               { "allow-x-send-file",  NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },      /* 15 */
-                                               { "strip-request-uri",  NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },      /* 16 */
-                                               { "kill-signal",        NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },      /* 17 */
-+                                              { "fix-root-scriptname",   NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },  /* 18 */
-                                               { NULL,                NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
-                                       };
-@@ -1220,6 +1233,7 @@
-                                       host->break_scriptfilename_for_php = 0;
-                                       host->allow_xsendfile = 0; /* handle X-LIGHTTPD-send-file */
-                                       host->kill_signal = SIGTERM;
-+                                      host->fix_root_path_name = 0;
-                                       fcv[0].destination = host->host;
-                                       fcv[1].destination = host->docroot;
-@@ -1241,6 +1255,7 @@
-                                       fcv[15].destination = &(host->allow_xsendfile);
-                                       fcv[16].destination = host->strip_request_uri;
-                                       fcv[17].destination = &(host->kill_signal);
-+                                      fcv[18].destination = &(host->fix_root_path_name);
-                                       if (0 != config_insert_values_internal(srv, da_host->value, fcv)) {
-                                               return HANDLER_ERROR;
-@@ -2544,7 +2559,10 @@
-                                       stat_cache_entry *sce;
-                                       if (HANDLER_ERROR != stat_cache_get_entry(srv, con, ds->value, &sce)) {
--                                              data_string *dcls = data_string_init();
-+                                              data_string *dcls;
-+                                              if (NULL == (dcls = (data_string *)array_get_unused_element(con->response.headers, TYPE_STRING))) {
-+                                                      dcls = data_response_init();
-+                                              }
-                                               /* found */
-                                               http_chunk_append_file(srv, con, ds->value, 0, sce->st.st_size);
-                                               hctx->send_content_body = 0; /* ignore the content */
-@@ -3074,7 +3092,7 @@
-               /* check if the next server has no load. */
-               ndx = hctx->ext->last_used_ndx + 1;
--              if(ndx >= hctx->ext->used || ndx < 0) ndx = 0;
-+              if(ndx >= (int) hctx->ext->used || ndx < 0) ndx = 0;
-               host = hctx->ext->hosts[ndx];
-               if (host->load > 0) {
-                       /* get backend with the least load. */
-@@ -3480,13 +3498,12 @@
-                       ct_len = extension->key->used - 1;
--                      if (s_len < ct_len) continue;
--
--                      /* check extension in the form "/fcgi_pattern" */
--                      if (*(extension->key->ptr) == '/') {
--                              if (strncmp(fn->ptr, extension->key->ptr, ct_len) == 0)
-+                      /* check _url_ in the form "/fcgi_pattern" */
-+                      if (extension->key->ptr[0] == '/') {
-+                              if ((ct_len <= con->uri.path->used -1) &&
-+                                  (strncmp(con->uri.path->ptr, extension->key->ptr, ct_len) == 0))
-                                       break;
--                      } else if (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len)) {
-+                      } else if ((ct_len <= s_len) && (0 == strncmp(fn->ptr + s_len - ct_len, extension->key->ptr, ct_len))) {
-                               /* check extension in the form ".fcg" */
-                               break;
-                       }
-@@ -3499,16 +3516,15 @@
+                                       switch ((ssl_r = SSL_get_error(ssl, r))) {
+@@ -243,12 +259,13 @@
+                               } else {
+                                       c->offset += r;
+                                       cq->bytes_out += r;
++                                      max_bytes -= r;
+                               }
  
-       /* check if we have at least one server for this extension up and running */
-       for (k = 0; k < extension->used; k++) {
--              host = extension->hosts[k];
-+              fcgi_extension_host *h = extension->hosts[k];
+                               if (c->offset == c->file.length) {
+                                       chunk_finished = 1;
+                               }
+-                      } while(!chunk_finished && !write_wait);
++                      } while (!chunk_finished && !write_wait && max_bytes > 0);
  
-               /* we should have at least one proc that can do something */
--              if (host->active_procs == 0) {
--                      host = NULL;
--
-+              if (h->active_procs == 0) {
-                       continue;
+                       break;
                }
+@@ -263,11 +280,9 @@
  
-               /* we found one host that is alive */
-+              host = h;
-               break;
+                       break;
+               }
+-
+-              chunks_written++;
        }
  
-@@ -3582,6 +3598,13 @@
-                        * SCRIPT_NAME = /fcgi-bin/foo
-                        * PATH_INFO   = /bar
-                        *
-+                       * if prefix = /, and fix-root-path-name is enable
-+                       *
-+                       * /fcgi-bin/foo/bar
-+                       *
-+                       * SCRIPT_NAME = /fcgi-bin/foo
-+                       * PATH_INFO   = /bar
-+                       *
-                        */
-                       /* the rewrite is only done for /prefix/? matches */
-@@ -3594,6 +3617,10 @@
+-      return chunks_written;
++      return 0;
+ }
+ #endif
  
-                               con->uri.path->used -= con->request.pathinfo->used - 1;
-                               con->uri.path->ptr[con->uri.path->used - 1] = '\0';
-+                      } else if (host->fix_root_path_name && extension->key->ptr[0] == '/' && extension->key->ptr[1] == '\0') {
-+                              buffer_copy_string(con->request.pathinfo, con->uri.path->ptr);
-+                              con->uri.path->used = 1;
-+                              con->uri.path->ptr[con->uri.path->used - 1] = '\0';
-                       }
-               }
-       } else {
-Index: src/mod_accesslog.c
+Index: src/http_auth.c
 ===================================================================
---- src/mod_accesslog.c        (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_accesslog.c        (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -473,7 +473,7 @@
-                       continue;
-               }
+--- src/http_auth.c    (.../tags/lighttpd-1.4.29)
++++ src/http_auth.c    (.../branches/lighttpd-1.4.x)
+@@ -1,7 +1,6 @@
+ #include "server.h"
+ #include "log.h"
+ #include "http_auth.h"
+-#include "http_auth_digest.h"
+ #include "inet_ntop_cache.h"
+ #include "stream.h"
+@@ -28,18 +27,23 @@
+ #include <unistd.h>
+ #include <ctype.h>
  
--              if (buffer_is_empty(s->access_logfile)) continue;
-+              if (s->access_logfile->used < 2) continue;
+-#ifdef USE_OPENSSL
+-# include <openssl/md5.h>
+-#else
+-# include "md5.h"
++#include "md5.h"
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
++#define HASHLEN 16
++#define HASHHEXLEN 32
++typedef unsigned char HASH[HASHLEN];
++typedef char HASHHEX[HASHHEXLEN+1];
+-#endif
++static void CvtHex(const HASH Bin, char Hex[33]) {
++      unsigned short i;
++      for (i = 0; i < 16; i++) {
++              Hex[i*2] = int2hex((Bin[i] >> 4) & 0xf);
++              Hex[i*2+1] = int2hex(Bin[i] & 0xf);
++      }
++      Hex[32] = '\0';
++}
++
+ /**
+  * the $apr1$ handling is taken from apache 1.3.x
+  */
+@@ -95,7 +99,7 @@
+       ch = in[0];
+       /* run through the whole string, converting as we go */
+       for (i = 0; i < in_len; i++) {
+-              ch = in[i];
++              ch = (unsigned char) in[i];
  
-               if (s->access_logfile->ptr[0] == '|') {
- #ifdef HAVE_FORK
-@@ -498,6 +498,8 @@
-                               /* not needed */
-                               close(to_log_fds[1]);
+               if (ch == '\0') break;
  
-+                              openDevNull(STDERR_FILENO);
-+
-                               /* we don't need the client socket */
-                               for (i = 3; i < 256; i++) {
-                                       close(i);
-@@ -570,7 +572,7 @@
-               }
+@@ -435,7 +439,7 @@
  
-               if (s->use_syslog == 0 &&
--                  !buffer_is_empty(s->access_logfile) &&
-+                  s->access_logfile->used > 1 &&
-                   s->access_logfile->ptr[0] != '|') {
+ static void to64(char *s, unsigned long v, int n)
+ {
+-    static unsigned char itoa64[] =         /* 0 ... 63 => ASCII - 64 */
++    static const unsigned char itoa64[] =         /* 0 ... 63 => ASCII - 64 */
+         "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+     while (--n >= 0) {
+@@ -455,7 +459,7 @@
+     const char *sp, *ep;
+     unsigned char final[APR_MD5_DIGESTSIZE];
+     ssize_t sl, pl, i;
+-    MD5_CTX ctx, ctx1;
++    li_MD5_CTX ctx, ctx1;
+     unsigned long l;
+     /*
+@@ -487,33 +491,33 @@
+     /*
+      * 'Time to make the doughnuts..'
+      */
+-    MD5_Init(&ctx);
++    li_MD5_Init(&ctx);
+     /*
+      * The password first, since that is what is most unknown
+      */
+-    MD5_Update(&ctx, pw, strlen(pw));
++    li_MD5_Update(&ctx, pw, strlen(pw));
+     /*
+      * Then our magic string
+      */
+-    MD5_Update(&ctx, APR1_ID, strlen(APR1_ID));
++    li_MD5_Update(&ctx, APR1_ID, strlen(APR1_ID));
+     /*
+      * Then the raw salt
+      */
+-    MD5_Update(&ctx, sp, sl);
++    li_MD5_Update(&ctx, sp, sl);
+     /*
+      * Then just as many characters of the MD5(pw, salt, pw)
+      */
+-    MD5_Init(&ctx1);
+-    MD5_Update(&ctx1, pw, strlen(pw));
+-    MD5_Update(&ctx1, sp, sl);
+-    MD5_Update(&ctx1, pw, strlen(pw));
+-    MD5_Final(final, &ctx1);
++    li_MD5_Init(&ctx1);
++    li_MD5_Update(&ctx1, pw, strlen(pw));
++    li_MD5_Update(&ctx1, sp, sl);
++    li_MD5_Update(&ctx1, pw, strlen(pw));
++    li_MD5_Final(final, &ctx1);
+     for (pl = strlen(pw); pl > 0; pl -= APR_MD5_DIGESTSIZE) {
+-        MD5_Update(&ctx, final,
++        li_MD5_Update(&ctx, final,
+                       (pl > APR_MD5_DIGESTSIZE) ? APR_MD5_DIGESTSIZE : pl);
+     }
  
-                       close(s->log_access_fd);
-@@ -647,6 +649,9 @@
+@@ -527,10 +531,10 @@
+      */
+     for (i = strlen(pw); i != 0; i >>= 1) {
+         if (i & 1) {
+-            MD5_Update(&ctx, final, 1);
++            li_MD5_Update(&ctx, final, 1);
+         }
+         else {
+-            MD5_Update(&ctx, pw, 1);
++            li_MD5_Update(&ctx, pw, 1);
+         }
+     }
  
-       mod_accesslog_patch_connection(srv, con, p);
+@@ -542,7 +546,7 @@
+     strncat(passwd, sp, sl);
+     strcat(passwd, "$");
+-    MD5_Final(final, &ctx);
++    li_MD5_Final(final, &ctx);
+     /*
+      * And now, just to make sure things don't run too fast..
+@@ -550,28 +554,28 @@
+      * need 30 seconds to build a 1000 entry dictionary...
+      */
+     for (i = 0; i < 1000; i++) {
+-        MD5_Init(&ctx1);
++        li_MD5_Init(&ctx1);
+         if (i & 1) {
+-            MD5_Update(&ctx1, pw, strlen(pw));
++            li_MD5_Update(&ctx1, pw, strlen(pw));
+         }
+         else {
+-            MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE);
++            li_MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE);
+         }
+         if (i % 3) {
+-            MD5_Update(&ctx1, sp, sl);
++            li_MD5_Update(&ctx1, sp, sl);
+         }
+         if (i % 7) {
+-            MD5_Update(&ctx1, pw, strlen(pw));
++            li_MD5_Update(&ctx1, pw, strlen(pw));
+         }
+         if (i & 1) {
+-            MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE);
++            li_MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE);
+         }
+         else {
+-            MD5_Update(&ctx1, pw, strlen(pw));
++            li_MD5_Update(&ctx1, pw, strlen(pw));
+         }
+-        MD5_Final(final,&ctx1);
++        li_MD5_Final(final,&ctx1);
+     }
  
-+      /* No output device, nothing to do */
-+      if (!p->conf.use_syslog && p->conf.log_access_fd == -1) return HANDLER_GO_ON;
-+
-       b = p->conf.access_logbuffer;
-       if (b->used == 0) {
-               buffer_copy_string(b, "");
-@@ -806,7 +811,14 @@
-                               buffer_append_string(b, "%");
-                               break;
-                       case FORMAT_SERVER_PORT:
--                              buffer_append_long(b, srv->srvconf.port);
-+                              {
-+                                      char *colon = strchr(((server_socket*)(con->srv_socket))->srv_token->ptr, ':');
-+                                      if (colon) {
-+                                              buffer_append_string(b, colon+1);
-+                                      } else {
-+                                              buffer_append_long(b, srv->srvconf.port);
-+                                      }
-+                              }
-                               break;
-                       case FORMAT_QUERY_STRING:
-                               buffer_append_string_buffer(b, con->uri.query);
-Index: src/server.c
-===================================================================
---- src/server.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/server.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -573,20 +573,9 @@
+     p = passwd + strlen(passwd);
+@@ -614,17 +618,17 @@
+                * user:realm:md5(user:realm:password)
+                */
+-              MD5_CTX Md5Ctx;
++              li_MD5_CTX Md5Ctx;
+               HASH HA1;
+               char a1[256];
+-              MD5_Init(&Md5Ctx);
+-              MD5_Update(&Md5Ctx, (unsigned char *)username->ptr, username->used - 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)realm->ptr, realm->used - 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)pw, strlen(pw));
+-              MD5_Final(HA1, &Md5Ctx);
++              li_MD5_Init(&Md5Ctx);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)username->ptr, username->used - 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)realm->ptr, realm->used - 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)pw, strlen(pw));
++              li_MD5_Final(HA1, &Md5Ctx);
+               CvtHex(HA1, a1);
+@@ -930,7 +934,7 @@
+       int i;
+       buffer *password, *b, *username_buf, *realm_buf;
+-      MD5_CTX Md5Ctx;
++      li_MD5_CTX Md5Ctx;
+       HASH HA1;
+       HASH HA2;
+       HASH RespHash;
+@@ -1067,13 +1071,13 @@
+       if (p->conf.auth_backend == AUTH_BACKEND_PLAIN) {
+               /* generate password from plain-text */
+-              MD5_Init(&Md5Ctx);
+-              MD5_Update(&Md5Ctx, (unsigned char *)username, strlen(username));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)realm, strlen(realm));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)password->ptr, password->used - 1);
+-              MD5_Final(HA1, &Md5Ctx);
++              li_MD5_Init(&Md5Ctx);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)username, strlen(username));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)realm, strlen(realm));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)password->ptr, password->used - 1);
++              li_MD5_Final(HA1, &Md5Ctx);
+       } else if (p->conf.auth_backend == AUTH_BACKEND_HTDIGEST) {
+               /* HA1 */
+               /* transform the 32-byte-hex-md5 to a 16-byte-md5 */
+@@ -1090,45 +1094,45 @@
+       if (algorithm &&
+           strcasecmp(algorithm, "md5-sess") == 0) {
+-              MD5_Init(&Md5Ctx);
+-              MD5_Update(&Md5Ctx, (unsigned char *)HA1, 16);
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)nonce, strlen(nonce));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)cnonce, strlen(cnonce));
+-              MD5_Final(HA1, &Md5Ctx);
++              li_MD5_Init(&Md5Ctx);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)HA1, 16);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)nonce, strlen(nonce));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)cnonce, strlen(cnonce));
++              li_MD5_Final(HA1, &Md5Ctx);
        }
  
-       /* close stdin and stdout, as they are not needed */
--      /* move stdin to /dev/null */
--      if (-1 != (fd = open("/dev/null", O_RDONLY))) {
--              close(STDIN_FILENO);
--              dup2(fd, STDIN_FILENO);
--              close(fd);
--      }
-+      openDevNull(STDIN_FILENO);
-+      openDevNull(STDOUT_FILENO);
--      /* move stdout to /dev/null */
--      if (-1 != (fd = open("/dev/null", O_WRONLY))) {
--              close(STDOUT_FILENO);
--              dup2(fd, STDOUT_FILENO);
--              close(fd);
--      }
--
-       if (0 != config_set_defaults(srv)) {
-               log_error_write(srv, __FILE__, __LINE__, "s",
-                               "setting default values failed");
-@@ -893,8 +882,8 @@
-               pid_fd = -1;
+       CvtHex(HA1, a1);
+       /* calculate H(A2) */
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)m, strlen(m));
+-      MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-      MD5_Update(&Md5Ctx, (unsigned char *)uri, strlen(uri));
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)m, strlen(m));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)uri, strlen(uri));
+       if (qop && strcasecmp(qop, "auth-int") == 0) {
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)"", HASHHEXLEN);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)"", HASHHEXLEN);
        }
--      // Close stderr ASAP in the child process to make sure that nothing
--      // is being written to that fd which may not be valid anymore.
-+      /* Close stderr ASAP in the child process to make sure that nothing
-+       * is being written to that fd which may not be valid anymore. */
-       if (-1 == log_error_open(srv)) {
-               log_error_write(srv, __FILE__, __LINE__, "s", "Opening errorlog failed. Going down.");
-Index: src/mod_dirlisting.c
+-      MD5_Final(HA2, &Md5Ctx);
++      li_MD5_Final(HA2, &Md5Ctx);
+       CvtHex(HA2, HA2Hex);
+       /* calculate response */
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)a1, HASHHEXLEN);
+-      MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-      MD5_Update(&Md5Ctx, (unsigned char *)nonce, strlen(nonce));
+-      MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)a1, HASHHEXLEN);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)nonce, strlen(nonce));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+       if (qop && *qop) {
+-              MD5_Update(&Md5Ctx, (unsigned char *)nc, strlen(nc));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)cnonce, strlen(cnonce));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+-              MD5_Update(&Md5Ctx, (unsigned char *)qop, strlen(qop));
+-              MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)nc, strlen(nc));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)cnonce, strlen(cnonce));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
++              li_MD5_Update(&Md5Ctx, (unsigned char *)qop, strlen(qop));
++              li_MD5_Update(&Md5Ctx, (unsigned char *)":", 1);
+       };
+-      MD5_Update(&Md5Ctx, (unsigned char *)HA2Hex, HASHHEXLEN);
+-      MD5_Final(RespHash, &Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)HA2Hex, HASHHEXLEN);
++      li_MD5_Final(RespHash, &Md5Ctx);
+       CvtHex(RespHash, a2);
+       if (0 != strcmp(a2, respons)) {
+@@ -1171,24 +1175,24 @@
+ int http_auth_digest_generate_nonce(server *srv, mod_auth_plugin_data *p, buffer *fn, char out[33]) {
+       HASH h;
+-      MD5_CTX Md5Ctx;
++      li_MD5_CTX Md5Ctx;
+       char hh[32];
+       UNUSED(p);
+       /* generate shared-secret */
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)fn->ptr, fn->used - 1);
+-      MD5_Update(&Md5Ctx, (unsigned char *)"+", 1);
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)fn->ptr, fn->used - 1);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)"+", 1);
+       /* we assume sizeof(time_t) == 4 here, but if not it ain't a problem at all */
+       LI_ltostr(hh, srv->cur_ts);
+-      MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
+-      MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
+       LI_ltostr(hh, rand());
+-      MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
+-      MD5_Final(h, &Md5Ctx);
++      li_MD5_Final(h, &Md5Ctx);
+       CvtHex(h, out);
+Index: src/mod_usertrack.c
 ===================================================================
---- src/mod_dirlisting.c       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_dirlisting.c       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -841,11 +841,11 @@
-       /* Insert possible charset to Content-Type */
-       if (buffer_is_empty(p->conf.encoding)) {
--              response_header_insert(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
-+              response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
-       } else {
-               buffer_copy_string(p->content_charset, "text/html; charset=");
-               buffer_append_string_buffer(p->content_charset, p->conf.encoding);
--              response_header_insert(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->content_charset));
-+              response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->content_charset));
-       }
+--- src/mod_usertrack.c        (.../tags/lighttpd-1.4.29)
++++ src/mod_usertrack.c        (.../branches/lighttpd-1.4.x)
+@@ -8,18 +8,8 @@
+ #include <stdlib.h>
+ #include <string.h>
  
-       con->file_finished = 1;
-Index: src/mod_magnet.c
-===================================================================
---- src/mod_magnet.c   (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/mod_magnet.c   (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -414,10 +414,16 @@
-       case MAGNET_ENV_URI_AUTHORITY: dest = con->uri.authority; break;
-       case MAGNET_ENV_URI_QUERY: dest = con->uri.query; break;
--      case MAGNET_ENV_REQUEST_METHOD:   break;
-+      case MAGNET_ENV_REQUEST_METHOD:
-+              buffer_copy_string(srv->tmp_buf, get_http_method_name(con->request.http_method));
-+              dest = srv->tmp_buf;
-+              break;
-       case MAGNET_ENV_REQUEST_URI:      dest = con->request.uri; break;
-       case MAGNET_ENV_REQUEST_ORIG_URI: dest = con->request.orig_uri; break;
--      case MAGNET_ENV_REQUEST_PROTOCOL: break;
-+      case MAGNET_ENV_REQUEST_PROTOCOL:
-+              buffer_copy_string(srv->tmp_buf, get_http_version_name(con->request.http_version));
-+              dest = srv->tmp_buf;
-+              break;
-       case MAGNET_ENV_UNSET: break;
-       }
-@@ -761,11 +767,13 @@
+-#ifdef USE_OPENSSL
+-# include <openssl/md5.h>
+-#else
+-# include "md5.h"
++#include "md5.h"
  
-       if (lua_return_value > 99) {
-               con->http_status = lua_return_value;
--              con->file_finished = 1;
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
+-
+-#endif
+-
+ /* plugin config for all request/connections */
  
-               /* try { ...*/
-               if (0 == setjmp(exceptionjmp)) {
-                       magnet_attach_content(srv, con, p, L);
-+                      if (!chunkqueue_is_empty(con->write_queue)) {
-+                              con->mode = p->id;
-+                      }
-               } else {
-                       /* } catch () { */
-                       con->http_status = 500;
-Index: src/log.c
+ typedef struct {
+@@ -182,7 +172,7 @@
+       plugin_data *p = p_d;
+       data_string *ds;
+       unsigned char h[16];
+-      MD5_CTX Md5Ctx;
++      li_MD5_CTX Md5Ctx;
+       char hh[32];
+       if (con->uri.path->used == 0) return HANDLER_GO_ON;
+@@ -228,18 +218,18 @@
+       /* taken from mod_auth.c */
+       /* generate shared-secret */
+-      MD5_Init(&Md5Ctx);
+-      MD5_Update(&Md5Ctx, (unsigned char *)con->uri.path->ptr, con->uri.path->used - 1);
+-      MD5_Update(&Md5Ctx, (unsigned char *)"+", 1);
++      li_MD5_Init(&Md5Ctx);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)con->uri.path->ptr, con->uri.path->used - 1);
++      li_MD5_Update(&Md5Ctx, (unsigned char *)"+", 1);
+       /* we assume sizeof(time_t) == 4 here, but if not it ain't a problem at all */
+       LI_ltostr(hh, srv->cur_ts);
+-      MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
+-      MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)srv->entropy, sizeof(srv->entropy));
+       LI_ltostr(hh, rand());
+-      MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
++      li_MD5_Update(&Md5Ctx, (unsigned char *)hh, strlen(hh));
+-      MD5_Final(h, &Md5Ctx);
++      li_MD5_Final(h, &Md5Ctx);
+       buffer_append_string_encoded(ds->value, (char *)h, 16, ENCODING_HEX);
+       buffer_append_string_len(ds->value, CONST_STR_LEN("; Path=/"));
+Index: src/mod_status.c
 ===================================================================
---- src/log.c  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/log.c  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -31,6 +31,29 @@
- # define O_LARGEFILE 0
- #endif
+--- src/mod_status.c   (.../tags/lighttpd-1.4.29)
++++ src/mod_status.c   (.../branches/lighttpd-1.4.x)
+@@ -487,7 +487,7 @@
+               buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));
+-              if (con->request.content_length) {
++              if (c->request.content_length) {
+                       buffer_append_long(b, c->request_content_queue->bytes_in);
+                       buffer_append_string_len(b, CONST_STR_LEN("/"));
+                       buffer_append_long(b, c->request.content_length);
+Index: src/settings.h
+===================================================================
+--- src/settings.h     (.../tags/lighttpd-1.4.29)
++++ src/settings.h     (.../branches/lighttpd-1.4.x)
+@@ -21,8 +21,11 @@
+  * 64kB (no real reason, just a guess)
+  */
+ #define BUFFER_MAX_REUSE_SIZE  (4 * 1024)
+-#define MAX_READ_LIMIT (4*1024*1024)
  
-+/* Close fd and _try_ to get a /dev/null for it instead.
-+ * close() alone may trigger some bugs when a
-+ * process opens another file and gets fd = STDOUT_FILENO or STDERR_FILENO
-+ * and later tries to just print on stdout/stderr
-+ *
-+ * Returns 0 on success and -1 on failure (fd gets closed in all cases)
-+ */
-+int openDevNull(int fd) {
-+      int tmpfd;
-+      close(fd);
-+#if defined(__WIN32)
-+      /* Cygwin should work with /dev/null */
-+      tmpfd = open("nul", O_RDWR);
-+#else
-+      tmpfd = open("/dev/null", O_RDWR);
-+#endif
-+      if (tmpfd != -1 && tmpfd != fd) {
-+              dup2(tmpfd, fd);
-+              close(tmpfd);
-+      }
-+      return (tmpfd != -1) ? 0 : -1;
-+}
++/* both should be way smaller than SSIZE_MAX :) */
++#define MAX_READ_LIMIT (256*1024)
++#define MAX_WRITE_LIMIT (256*1024)
 +
  /**
-  * open the errorlog
+  * max size of the HTTP request header
   *
-@@ -44,7 +67,6 @@
+Index: src/mod_cml_lua.c
+===================================================================
+--- src/mod_cml_lua.c  (.../tags/lighttpd-1.4.29)
++++ src/mod_cml_lua.c  (.../branches/lighttpd-1.4.x)
+@@ -11,18 +11,6 @@
+ #include <time.h>
+ #include <string.h>
+-#ifdef USE_OPENSSL
+-# include <openssl/md5.h>
+-#else
+-# include "md5.h"
+-
+-typedef li_MD5_CTX MD5_CTX;
+-#define MD5_Init li_MD5_Init
+-#define MD5_Update li_MD5_Update
+-#define MD5_Final li_MD5_Final
+-
+-#endif
+-
+ #define HASHLEN 16
+ typedef unsigned char HASH[HASHLEN];
+ #define HASHHEXLEN 32
+Index: src/mod_fastcgi.c
+===================================================================
+--- src/mod_fastcgi.c  (.../tags/lighttpd-1.4.29)
++++ src/mod_fastcgi.c  (.../branches/lighttpd-1.4.x)
+@@ -3075,7 +3075,7 @@
+               fcgi_set_state(srv, hctx, FCGI_STATE_WRITE);
+               /* fall through */
+       case FCGI_STATE_WRITE:
+-              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb);
++              ret = srv->network_backend_write(srv, con, hctx->fd, hctx->wb, MAX_WRITE_LIMIT);
+               chunkqueue_remove_finished_chunks(hctx->wb);
+@@ -3132,7 +3132,6 @@
+       plugin_data *p = p_d;
+       handler_ctx *hctx = con->plugin_ctx[p->id];
+-      fcgi_proc *proc;
+       fcgi_extension_host *host;
+       if (NULL == hctx) return HANDLER_GO_ON;
+@@ -3201,7 +3200,6 @@
+       /* ok, create the request */
+       switch(fcgi_write_request(srv, hctx)) {
+       case HANDLER_ERROR:
+-              proc = hctx->proc;
+               host = hctx->host;
+               if (hctx->state == FCGI_STATE_INIT ||
+Index: src/network_solaris_sendfilev.c
+===================================================================
+--- src/network_solaris_sendfilev.c    (.../tags/lighttpd-1.4.29)
++++ src/network_solaris_sendfilev.c    (.../branches/lighttpd-1.4.x)
+@@ -38,17 +38,16 @@
   */
  
- int log_error_open(server *srv) {
--      int fd;
-       int close_stderr = 1;
  
- #ifdef HAVE_SYSLOG_H
-@@ -78,15 +100,16 @@
-       /* don't close stderr for debugging purposes if run in valgrind */
-       if (RUNNING_ON_VALGRIND) close_stderr = 0;
- #endif
--      if (srv->errorlog_mode == ERRORLOG_STDERR) close_stderr = 0;
+-int network_write_chunkqueue_solarissendfilev(server *srv, connection *con, int fd, chunkqueue *cq) {
++int network_write_chunkqueue_solarissendfilev(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes) {
+       chunk *c;
+-      size_t chunks_written = 0;
+-      for(c = cq->first; c; c = c->next, chunks_written++) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
+                       size_t num_chunks, i;
+@@ -77,9 +76,9 @@
+                                       chunks[i].iov_base = offset;
+                                       /* protect the return value of writev() */
+-                                      if (toSend > SSIZE_MAX ||
+-                                          num_bytes + toSend > SSIZE_MAX) {
+-                                              chunks[i].iov_len = SSIZE_MAX - num_bytes;
++                                      if (toSend > max_bytes ||
++                                          (off_t) num_bytes + toSend > max_bytes) {
++                                              chunks[i].iov_len = max_bytes - num_bytes;
+                                               num_chunks = i + 1;
+                                               break;
+@@ -119,11 +118,10 @@
+                                       if (chunk_finished) {
+                                               /* skip the chunks from further touches */
+-                                              chunks_written++;
+                                               c = c->next;
+                                       } else {
+                                               /* chunks_written + c = c->next is done in the for()*/
+-                                              chunk_finished++;
++                                              chunk_finished = 1;
+                                       }
+                               } else {
+                                       /* partially written */
+@@ -139,8 +137,8 @@
+               }
+               case FILE_CHUNK: {
+                       ssize_t r;
+-                      off_t offset;
+-                      size_t toSend, written;
++                      off_t offset, toSend;
++                      size_t written;
+                       sendfilevec_t fvec;
+                       stat_cache_entry *sce = NULL;
+                       int ifd;
+@@ -153,6 +151,7 @@
+                       offset = c->file.start + c->offset;
+                       toSend = c->file.length - c->offset;
++                      if (toSend > max_bytes) toSend = max_bytes;
+                       if (offset > sce->st.st_size) {
+                               log_error_write(srv, __FILE__, __LINE__, "sb", "file was shrinked:", c->file.name);
+@@ -186,6 +185,7 @@
+                       close(ifd);
+                       c->offset += written;
+                       cq->bytes_out += written;
++                      max_bytes -= written;
+                       if (c->offset == c->file.length) {
+                               chunk_finished = 1;
+@@ -207,7 +207,7 @@
+               }
+       }
  
-+      if (srv->errorlog_mode == ERRORLOG_STDERR && srv->srvconf.dont_daemonize) {
-+              /* We can only log to stderr in dont-daemonize mode;
-+               * if we do daemonize and no errorlog file is specified, we log into /dev/null
-+               */
-+              close_stderr = 0;
-+      }
-+
-       /* move stderr to /dev/null */
--      if (close_stderr &&
--          -1 != (fd = open("/dev/null", O_WRONLY))) {
--              close(STDERR_FILENO);
--              dup2(fd, STDERR_FILENO);
--              close(fd);
--      }
-+      if (close_stderr) openDevNull(STDERR_FILENO);
-       return 0;
+-      return chunks_written;
++      return 0;
  }
  
-Index: src/log.h
+ #endif
+Index: src/CMakeLists.txt
+===================================================================
+Index: src/mod_dirlisting.c
 ===================================================================
---- src/log.h  (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ src/log.h  (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -3,6 +3,11 @@
+--- src/mod_dirlisting.c       (.../tags/lighttpd-1.4.29)
++++ src/mod_dirlisting.c       (.../branches/lighttpd-1.4.x)
+@@ -657,7 +657,8 @@
+       i = dir->used - 1;
+ #ifdef HAVE_PATHCONF
+-      if (-1 == (name_max = pathconf(dir->ptr, _PC_NAME_MAX))) {
++      if (0 >= (name_max = pathconf(dir->ptr, _PC_NAME_MAX))) {
++              /* some broken fs (fuse) return 0 instead of -1 */
+ #ifdef NAME_MAX
+               name_max = NAME_MAX;
+ #else
+Index: src/network_linux_sendfile.c
+===================================================================
+--- src/network_linux_sendfile.c       (.../tags/lighttpd-1.4.29)
++++ src/network_linux_sendfile.c       (.../branches/lighttpd-1.4.x)
+@@ -27,17 +27,16 @@
+ /* on linux 2.4.29 + debian/ubuntu we have crashes if this is enabled */
+ #undef HAVE_POSIX_FADVISE
+-int network_write_chunkqueue_linuxsendfile(server *srv, connection *con, int fd, chunkqueue *cq) {
++int network_write_chunkqueue_linuxsendfile(server *srv, connection *con, int fd, chunkqueue *cq, off_t max_bytes) {
+       chunk *c;
+-      size_t chunks_written = 0;
+-      for(c = cq->first; c; c = c->next, chunks_written++) {
++      for(c = cq->first; (max_bytes > 0) && (NULL != c); c = c->next) {
+               int chunk_finished = 0;
+               switch(c->type) {
+               case MEM_CHUNK: {
+                       char * offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       ssize_t r;
+                       size_t num_chunks, i;
+@@ -45,12 +44,10 @@
+                       chunk *tc;
+                       size_t num_bytes = 0;
+-                      /* we can't send more then SSIZE_MAX bytes in one chunk */
+-
+                       /* build writev list
+                        *
+                        * 1. limit: num_chunks < UIO_MAXIOV
+-                       * 2. limit: num_bytes < SSIZE_MAX
++                       * 2. limit: num_bytes < max_bytes
+                        */
+                       for (num_chunks = 0, tc = c;
+                            tc && tc->type == MEM_CHUNK && num_chunks < UIO_MAXIOV;
+@@ -67,9 +64,9 @@
+                                       chunks[i].iov_base = offset;
+                                       /* protect the return value of writev() */
+-                                      if (toSend > SSIZE_MAX ||
+-                                          num_bytes + toSend > SSIZE_MAX) {
+-                                              chunks[i].iov_len = SSIZE_MAX - num_bytes;
++                                      if (toSend > max_bytes ||
++                                          (off_t) num_bytes + toSend > max_bytes) {
++                                              chunks[i].iov_len = max_bytes - num_bytes;
+                                               num_chunks = i + 1;
+                                               break;
+@@ -100,6 +97,7 @@
+                       /* check which chunks have been written */
+                       cq->bytes_out += r;
++                      max_bytes -= r;
+                       for(i = 0, tc = c; i < num_chunks; i++, tc = tc->next) {
+                               if (r >= (ssize_t)chunks[i].iov_len) {
+@@ -109,11 +107,10 @@
+                                       if (chunk_finished) {
+                                               /* skip the chunks from further touches */
+-                                              chunks_written++;
+                                               c = c->next;
+                                       } else {
+                                               /* chunks_written + c = c->next is done in the for()*/
+-                                              chunk_finished++;
++                                              chunk_finished = 1;
+                                       }
+                               } else {
+                                       /* partially written */
+@@ -130,13 +127,12 @@
+               case FILE_CHUNK: {
+                       ssize_t r;
+                       off_t offset;
+-                      size_t toSend;
++                      off_t toSend;
+                       stat_cache_entry *sce = NULL;
  
- #include "server.h"
+                       offset = c->file.start + c->offset;
+-                      /* limit the toSend to 2^31-1 bytes in a chunk */
+-                      toSend = c->file.length - c->offset > ((1 << 30) - 1) ?
+-                              ((1 << 30) - 1) : c->file.length - c->offset;
++                      toSend = c->file.length - c->offset;
++                      if (toSend > max_bytes) toSend = max_bytes;
  
-+/* Close fd and _try_ to get a /dev/null for it instead.
-+ * Returns 0 on success and -1 on failure (fd gets closed in all cases)
-+ */
-+int openDevNull(int fd);
-+
- #define WP() log_error_write(srv, __FILE__, __LINE__, "");
- int log_error_open(server *srv);
-
-Property changes on: tests/symlink.t
-___________________________________________________________________
-Name: svn:executable
-   + *
-
-Index: tests/request.t
+                       /* open file if not already opened */
+                       if (-1 == c->file.fd) {
+@@ -215,6 +211,7 @@
+                       c->offset += r;
+                       cq->bytes_out += r;
++                      max_bytes -= r;
+                       if (c->offset == c->file.length) {
+                               chunk_finished = 1;
+@@ -243,7 +240,7 @@
+               }
+       }
+-      return chunks_written;
++      return 0;
+ }
+ #endif
+Index: tests/mod-auth.t
 ===================================================================
---- tests/request.t    (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ tests/request.t    (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -101,7 +101,7 @@
- Expect: 100-continue
+--- tests/mod-auth.t   (.../tags/lighttpd-1.4.29)
++++ tests/mod-auth.t   (.../branches/lighttpd-1.4.x)
+@@ -8,7 +8,7 @@
+ use strict;
+ use IO::Socket;
+-use Test::More tests => 14;
++use Test::More tests => 15;
+ use LightyTest;
+ my $tf = LightyTest->new();
+@@ -25,6 +25,14 @@
+ $t->{REQUEST}  = ( <<EOF
+ GET /server-status HTTP/1.0
++Authorization: Basic \x80mFuOmphb
++EOF
++ );
++$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
++ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid base64 Auth-token');
++
++$t->{REQUEST}  = ( <<EOF
++GET /server-status HTTP/1.0
+ Authorization: Basic amFuOmphb
  EOF
   );
--$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417, '-HTTP-Content' => ''} ];
-+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417 } ];
- ok($tf->handle_http($t) == 0, 'Continue, Expect');
- ## ranges
-
-Property changes on: tests/env-variables.t
-___________________________________________________________________
-Name: svn:executable
-   + *
-
-Index: tests/mod-fastcgi.t
+Index: tests/request.t
 ===================================================================
---- tests/mod-fastcgi.t        (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ tests/mod-fastcgi.t        (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -65,7 +65,7 @@
- EOF
-  );
-       $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/get-server-env.php' } ];
--      ok($tf->handle_http($t) == 0, '$_SERVER["PHP_SELF"]');
-+      ok($tf->handle_http($t) == 0, '$_SERVER["SCRIPT_NAME"]');
+--- tests/request.t    (.../tags/lighttpd-1.4.29)
++++ tests/request.t    (.../branches/lighttpd-1.4.x)
+@@ -8,7 +8,7 @@
+ use strict;
+ use IO::Socket;
+-use Test::More tests => 44;
++use Test::More tests => 46;
+ use LightyTest;
+ my $tf = LightyTest->new();
+@@ -413,5 +413,21 @@
+ $t->{SLOWREQUEST} = 1;
+ ok($tf->handle_http($t) == 0, 'GET, slow \\r\\n\\r\\n (#2105)');
++print "\nPathinfo for static files\n";
++$t->{REQUEST}  = ( <<EOF
++GET /image.jpg/index.php HTTP/1.0
++EOF
++ );
++$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ];
++ok($tf->handle_http($t) == 0, 'static file accepting pathinfo by default');
++
++$t->{REQUEST}  = ( <<EOF
++GET /image.jpg/index.php HTTP/1.0
++Host: zzz.example.org
++EOF
++ );
++$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
++ok($tf->handle_http($t) == 0, 'static file with forbidden pathinfo');
++
+ ok($tf->stop_proc == 0, "Stopping lighttpd");
  
-       $t->{REQUEST}  = ( <<EOF
- GET /get-server-env.php/foo?env=PATH_INFO HTTP/1.0
-Index: tests/docroot/www/get-env.php
+Index: tests/wrapper.sh
 ===================================================================
---- tests/docroot/www/get-env.php      (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ tests/docroot/www/get-env.php      (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -1,3 +1,4 @@
- <?php
--      print $_ENV[$_GET["env"]];
-+      $env = $_GET["env"];
-+      print isset($_ENV[$env]) ? $_ENV[$env] : '';
- ?>
-
-Property changes on: tests/core-404-handler.t
-___________________________________________________________________
-Name: svn:executable
-   + *
-
-Index: doc/userdir.txt
+--- tests/wrapper.sh   (.../tags/lighttpd-1.4.29)
++++ tests/wrapper.sh   (.../branches/lighttpd-1.4.x)
+@@ -6,4 +6,4 @@
+ top_builddir=$2
+ export SHELL srcdir top_builddir
+-$3
++exec $3
+Index: tests/lighttpd.conf
 ===================================================================
---- doc/userdir.txt    (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ doc/userdir.txt    (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -46,10 +46,10 @@
- Options
- =======
--userdir.path
-+userdir.path (required option)
-   usually it should be set to "public_html" to take ~/public_html/ as the document root
--  Default: empty (document root is the home directory)
-+  Default: unset (mod_userdir disabled; set it to "" if you want the home directory to be the document root as it was the default before 1.4.19)
-   Example: ::
+--- tests/lighttpd.conf        (.../tags/lighttpd-1.4.29)
++++ tests/lighttpd.conf        (.../branches/lighttpd-1.4.x)
+@@ -149,6 +149,7 @@
+ $HTTP["host"] == "zzz.example.org" {
+   server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
+   server.name = "zzz.example.org"
++  static-file.disable-pathinfo = "enable"
+ }
  
-     userdir.path = "public_html"
-Index: SConstruct
+ $HTTP["host"] == "symlink.example.org" {
+Index: configure.ac
 ===================================================================
---- SConstruct (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ SConstruct (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -5,7 +5,7 @@
- from stat import *
- package = 'lighttpd'
--version = '1.4.19'
-+version = '1.4.20'
- def checkCHeaders(autoconf, hdrs):
-       p = re.compile('[^A-Z0-9]')
-Index: Makefile.am
+Index: doc/config/lighttpd.conf
+===================================================================
+--- doc/config/lighttpd.conf   (.../tags/lighttpd-1.4.29)
++++ doc/config/lighttpd.conf   (.../branches/lighttpd-1.4.x)
+@@ -394,6 +394,25 @@
+ ##   $SERVER["socket"] == "10.0.0.1:443" {
+ ##     ssl.engine                  = "enable"
+ ##     ssl.pemfile                 = "/etc/ssl/private/www.example.com.pem"
++##     #
++##     # Mitigate BEAST attack:
++##     #
++##     # A stricter base cipher suite. For details see:
++##     # http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html
++##     #
++##     ssl.ciphers                 = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
++##     #
++##     # Make the server prefer the order of the server side cipher suite instead of the client suite.
++##     # This is necessary to mitigate the BEAST attack (unless you disable all non RC4 algorithms).
++##     # This option is enabled by default, but only used if ssl.ciphers is set.
++##     #
++##     # ssl.honor-cipher-order = "enable"
++##     #
++##     # Mitigate CVE-2009-3555 by disabling client triggered renegotation
++##     # This is enabled by default.
++##     #
++##     # ssl.disable-client-renegotiation = "enable"
++##     #
+ ##     server.name                 = "www.example.com"
+ ##
+ ##     server.document-root        = "/srv/www/vhosts/example.com/www/"
+Index: SConstruct
 ===================================================================
---- Makefile.am        (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ Makefile.am        (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -1,3 +1,3 @@
- SUBDIRS=src doc tests cygwin openwrt
--EXTRA_DIST=lighttpd.spec autogen.sh SConstruct
-+EXTRA_DIST=autogen.sh SConstruct
 Index: NEWS
 ===================================================================
---- NEWS       (.../tags/lighttpd-1.4.19)      (revision 2190)
-+++ NEWS       (.../branches/lighttpd-1.4.x)   (revision 2190)
-@@ -3,8 +3,31 @@
+--- NEWS       (.../tags/lighttpd-1.4.29)
++++ NEWS       (.../branches/lighttpd-1.4.x)
+@@ -3,7 +3,20 @@
  NEWS
  ====
  
--- 1.4.19 -
-+- 1.4.20 -
-+  * Fix mod_compress to compile with old gcc version (#1592)
-+  * Fix mod_extforward to compile with old gcc version (#1591)
-+  * Update documentation for #1587
-+  * Fix #285 again: read error after SSL_shutdown (thx marton.illes@balabit.com) and clear the error queue before some other calls (CVE-2008-1531)
-+  * Fix mod_magnet: enable "request.method" and "request.protocol" in lighty.env (#1308)
-+  * Fix segfault for appending matched parts if there was no regex matching (just give empty strings) (#1601)
-+  * Use data_response_init in mod_fastcgi x-sendfile handling for response.headers, fix a small "memleak" (#1628)
-+  * Don't send empty Server headers (#1620)
-+  * Fix conditional interpretation of core options
-+  * Enable escaping of % and $ in redirect/rewrite; only two cases changed their behaviour: "%%" => "%", "$$" => "$"
-+  * Fix accesslog port (should be port from the connection, not the "server.port") (#1618)
-+  * Fix mod_fastcgi prefix matching: match the prefix always against url, not the absolute filepath (regardless of check-local)
-+  * Overwrite Content-Type header in mod_dirlisting instead of inserting (#1614), patch by Henrik Holst
-+  * Handle EINTR in mod_cgi during write() (#1640)
-+  * Allow all http status codes by default; disable body only for 204,205 and 304; generate error pages for 4xx and 5xx (#1639)
-+  * Fix mod_magnet to set con->mode = p->id if it generates content, so returning 4xx/5xx doesn't append an error page
-+  * Remove lighttpd.spec* from source, fixing all problems with it ;-)
-+  * Do not rely on PATH_MAX (POSIX does not require it) (#580)
-+  * Disable logging to access.log if filename is an empty string
-+  * Implement a clean way to open /dev/null and use it to close stdin/out/err in the needed places (#624)
-+
-+- 1.4.19 - 2008-03-10
+-- 1.4.29 -
++- 1.4.30 -
++  * Always use our 'own' md5 implementation, fixes linking issues on MacOS (fixes #2331)
++  * Limit amount of bytes we send in one go; fixes stalling in one connection and timeouts on slow systems.
++  * [ssl] fix build errors when Elliptic-Curve Diffie-Hellman is disabled
++  * Add static-file.disable-pathinfo option to prevent handling of urls like .../secret.php/image.jpg as static file
++  * Don't overwrite 401 (auth required) with 501 (unknown method) (fixes #2341)
++  * Fix mod_status bug: always showed "0/0" in the "Read" column for uploads (fixes #2351)
++  * [mod_auth] Fix signedness error in http_auth (fixes #2370, CVE-2011-4362)
++  * [ssl] count renegotiations to prevent client renegotiations
++  * [ssl] add option to honor server cipher order (fixes #2364, BEAST attack)
++  * [core] accept dots in ipv6 addresses in host header (fixes #2359)
++  * [ssl] fix ssl connection aborts if files are larger than the MAX_WRITE_LIMIT (256kb)
 +
-   * added support for If-Range: <date> (#1346)
-   * added support for matching $HTTP["scheme"] in configs
-   * fixed initgroups() called after chroot (#1384)
-Index: .cvsignore
++- 1.4.29 - 2011-07-03
+   * Fix mod_proxy waiting for response even if content-length is 0 (fixes #2259)
+   * Silence annoying "connection closed: poll() -> ERR" error.log message (fixes #2257)
+   * mod_cgi: make read buffer as big as incoming data block
+Index: CMakeLists.txt
 ===================================================================
-
-Property changes on: .
-___________________________________________________________________
-Name: svk:merge
-   - 152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-1.3.x:499
-152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-1.4.11-ssl-fixes:1346
-152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-merge-1.4.x:1041
-152afb58-edef-0310-8abb-c4023f1b3aa9:/tags/lighttpd-1.4.11:1042
-152afb58-edef-0310-8abb-c4023f1b3aa9:/tags/release-1.3.13:105
-152afb58-edef-0310-8abb-c4023f1b3aa9:/trunk:104
-a98e19e4-a712-0410-8832-6551a15ffc53:/local/branches/lighttpd-1.4.x:1557
-ebd0e9cf-3e47-4385-9dd4-f0e25e97baa2:/local/lighttpd/branches/lighttpd-1.4.x:2164
-   + 152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-1.3.x:499
-152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-1.4.11-ssl-fixes:1346
-152afb58-edef-0310-8abb-c4023f1b3aa9:/branches/lighttpd-merge-1.4.x:1041
-152afb58-edef-0310-8abb-c4023f1b3aa9:/tags/lighttpd-1.4.11:1042
-152afb58-edef-0310-8abb-c4023f1b3aa9:/tags/release-1.3.13:105
-152afb58-edef-0310-8abb-c4023f1b3aa9:/trunk:104
-a98e19e4-a712-0410-8832-6551a15ffc53:/local/branches/lighttpd-1.4.x:1557
-ebd0e9cf-3e47-4385-9dd4-f0e25e97baa2:/local/lighttpd/branches/lighttpd-1.4.x:2250
-
This page took 0.656112 seconds and 4 git commands to generate.