Author: glen                         Date: Thu Feb  5 17:40:37 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update to r2389:
  * Do not pass Proxy-Connection: header from client to backend http server in 
mod_proxy (#1877)
  * Fix wrong malloc sizes in mod_accesslog (probably nothing bad happened...) 
(fixes #1855, thx ycheng)
  * Some small buffer.c fixes (closes #1837)
  * Remove floating point math from server.c (fixes #1402)
  * Disable SSLv2 by default
  * Use/enforce sane max-connection values (fixes #1803)
  * Allow mod_compress to return 304 (Not Modified); compress ignores the 
static-file.etags option.(fixes #1884)
  * Add option to ignore the "Expect: 100-continue" header instead of returning 
417 Expectation failed (closes #1017)
  * Use modified etags in mod_compress (fixes #1800)
  * Fix max-connection limit handling/100% cpu usage (fixes #1436)
  * Fix error handling in freebsd-sendfile (fixes #1813)

---- Files affected:
SOURCES:
   lighttpd-branch.diff (1.43 -> 1.44) 

---- Diffs:

================================================================
Index: SOURCES/lighttpd-branch.diff
diff -u SOURCES/lighttpd-branch.diff:1.43 SOURCES/lighttpd-branch.diff:1.44
--- SOURCES/lighttpd-branch.diff:1.43   Mon Jan 19 11:06:14 2009
+++ SOURCES/lighttpd-branch.diff        Thu Feb  5 18:40:31 2009
@@ -1,7 +1,7 @@
 Index: cmake/LighttpdMacros.cmake
 ===================================================================
 --- cmake/LighttpdMacros.cmake (.../tags/lighttpd-1.4.20)      (revision 0)
-+++ cmake/LighttpdMacros.cmake (.../branches/lighttpd-1.4.x)   (revision 2371)
++++ cmake/LighttpdMacros.cmake (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -0,0 +1,43 @@
 +## our modules are without the "lib" prefix
 +
@@ -50,8 +50,8 @@
 ===================================================================
 Index: src/configfile-glue.c
 ===================================================================
---- src/configfile-glue.c      (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/configfile-glue.c      (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/configfile-glue.c      (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/configfile-glue.c      (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -1,4 +1,5 @@
  #include <string.h>
 +#include <stdlib.h>
@@ -83,8 +83,8 @@
                                return -1;
 Index: src/mod_cgi.c
 ===================================================================
---- src/mod_cgi.c      (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_cgi.c      (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_cgi.c      (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_cgi.c      (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -822,15 +822,27 @@
                        );
                cgi_env_add(&env, CONST_STR_LEN("SERVER_PORT"), buf, 
strlen(buf));
@@ -153,10 +153,22 @@
                cgi_env_add(&env, CONST_STR_LEN("REMOTE_ADDR"), s, strlen(s));
  
                LI_ltostr(buf,
+Index: src/base.h
+===================================================================
+--- src/base.h (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/base.h (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -497,6 +497,7 @@
+ #endif
+       } stat_cache_engine;
+       unsigned short enable_cores;
++      unsigned short reject_expect_100_with_417;
+ } server_config;
+ 
+ typedef struct {
 Index: src/mod_rewrite.c
 ===================================================================
---- src/mod_rewrite.c  (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_rewrite.c  (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_rewrite.c  (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_rewrite.c  (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -350,11 +350,7 @@
  
        if (!p->conf.rewrite) return HANDLER_GO_ON;
@@ -172,8 +184,8 @@
                pcre *match;
 Index: src/connections.c
 ===================================================================
---- src/connections.c  (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/connections.c  (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/connections.c  (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/connections.c  (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -330,15 +330,13 @@
        buffer_prepare_copy(b, 4 * 1024);
        len = recv(con->fd, b->ptr, b->size - 1, 0);
@@ -208,8 +220,8 @@
                                                /* the chunk is too large now, 
close it */
 Index: src/mod_alias.c
 ===================================================================
---- src/mod_alias.c    (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_alias.c    (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_alias.c    (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_alias.c    (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -103,9 +103,8 @@
                                        }
                                        /* ok, they have same prefix. check 
position */
@@ -224,9 +236,34 @@
                                }
 Index: src/configfile.c
 ===================================================================
---- src/configfile.c   (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/configfile.c   (.../branches/lighttpd-1.4.x)   (revision 2371)
-@@ -940,7 +940,6 @@
+--- src/configfile.c   (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/configfile.c   (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -94,6 +94,7 @@
+               { "etag.use-inode",             NULL, T_CONFIG_BOOLEAN, 
T_CONFIG_SCOPE_SERVER }, /* 49 */
+               { "etag.use-mtime",             NULL, T_CONFIG_BOOLEAN, 
T_CONFIG_SCOPE_SERVER }, /* 50 */
+               { "etag.use-size",             NULL, T_CONFIG_BOOLEAN, 
T_CONFIG_SCOPE_SERVER }, /* 51 */
++              { "server.reject-expect-100-with-417",  NULL, T_CONFIG_BOOLEAN, 
T_CONFIG_SCOPE_SERVER }, /* 52 */
+               { "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 },
+               { "server.virtual-root",         "load mod_simple_vhost and use 
simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET },
+@@ -135,6 +136,7 @@
+ 
+       cv[43].destination = &(srv->srvconf.max_conns);
+       cv[12].destination = &(srv->srvconf.max_request_size);
++      cv[52].destination = &(srv->srvconf.reject_expect_100_with_417);
+       srv->config_storage = calloc(1, srv->config_context->used * 
sizeof(specific_config *));
+ 
+       assert(srv->config_storage);
+@@ -159,7 +161,7 @@
+               s->max_write_idle = 360;
+               s->use_xattr     = 0;
+               s->is_ssl        = 0;
+-              s->ssl_use_sslv2 = 1;
++              s->ssl_use_sslv2 = 0;
+               s->use_ipv6      = 0;
+ #ifdef HAVE_LSTAT
+               s->follow_symlink = 1;
+@@ -940,7 +942,6 @@
  }
  
  int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
@@ -234,7 +271,7 @@
        tokenizer_t t;
        int ret;
        buffer *source;
-@@ -960,7 +959,7 @@
+@@ -960,7 +961,7 @@
                chdir(context->basedir->ptr);
        }
  
@@ -245,8 +282,8 @@
                ret = -1;
 Index: src/mod_trigger_b4_dl.c
 ===================================================================
---- src/mod_trigger_b4_dl.c    (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_trigger_b4_dl.c    (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_trigger_b4_dl.c    (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_trigger_b4_dl.c    (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -1,5 +1,6 @@
  #include <ctype.h>
  #include <stdlib.h>
@@ -266,8 +303,8 @@
  #if defined(HAVE_PCRE_H)
 Index: src/mod_mysql_vhost.c
 ===================================================================
---- src/mod_mysql_vhost.c      (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_mysql_vhost.c      (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_mysql_vhost.c      (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_mysql_vhost.c      (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -245,7 +245,6 @@
                if (!(buffer_is_empty(s->myuser) ||
                      buffer_is_empty(s->mydb))) {
@@ -309,10 +346,32 @@
  }
  
  #define PATCH(x) \
+Index: src/request.c
+===================================================================
+--- src/request.c      (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/request.c      (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -894,11 +894,12 @@
+                                                                *
+                                                                */
+ 
+-                                                              
con->http_status = 417;
+-                                                              con->keep_alive 
= 0;
+-
+-                                                              
array_insert_unique(con->request.headers, (data_unset *)ds);
+-                                                              return 0;
++                                                              if 
(srv->srvconf.reject_expect_100_with_417 && 0 == 
buffer_caseless_compare(CONST_BUF_LEN(ds->value), 
CONST_STR_LEN("100-continue"))) {
++                                                                      
con->http_status = 417;
++                                                                      
con->keep_alive = 0;
++                                                                      
array_insert_unique(con->request.headers, (data_unset *)ds);
++                                                                      return 
0;
++                                                              }
+                                                       } else if (cmp > 0 && 0 
== (cmp = buffer_caseless_compare(CONST_BUF_LEN(ds->key), 
CONST_STR_LEN("Host")))) {
+                                                               if 
(!con->request.http_host) {
+                                                                       
con->request.http_host = ds->value;
 Index: src/inet_ntop_cache.c
 ===================================================================
---- src/inet_ntop_cache.c      (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/inet_ntop_cache.c      (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/inet_ntop_cache.c      (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/inet_ntop_cache.c      (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -11,7 +11,7 @@
  #ifdef HAVE_IPV6
        size_t ndx = 0, i;
@@ -324,8 +383,8 @@
                                /* IPv6 found in cache */
 Index: src/mod_rrdtool.c
 ===================================================================
---- src/mod_rrdtool.c  (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_rrdtool.c  (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_rrdtool.c  (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_rrdtool.c  (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -179,6 +179,11 @@
                p->read_fd = from_rrdtool_fds[0];
                p->rrdtool_pid = pid;
@@ -340,8 +399,8 @@
        }
 Index: src/response.c
 ===================================================================
---- src/response.c     (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/response.c     (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/response.c     (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/response.c     (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -44,16 +44,15 @@
        buffer_append_string(b, get_http_status_name(con->http_status));
  
@@ -431,10 +490,31 @@
                 * - based on the clean URL
                 *
                 */
+Index: src/buffer.c
+===================================================================
+--- src/buffer.c       (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/buffer.c       (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -159,7 +159,7 @@
+       if (!src) return -1;
+ 
+       if (src->used == 0) {
+-              b->used = 0;
++              buffer_reset(b);
+               return 0;
+       }
+       return buffer_copy_string_len(b, src->ptr, src->used - 1);
+@@ -187,6 +187,7 @@
+       if (!s || !b) return -1;
+ 
+       s_len = strlen(s);
++      if (s_len > maxlen)  s_len = maxlen;
+       buffer_prepare_append(b, maxlen + 1);
+       if (b->used == 0)
+               b->used++;
 Index: src/mod_simple_vhost.c
 ===================================================================
---- src/mod_simple_vhost.c     (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_simple_vhost.c     (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_simple_vhost.c     (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_simple_vhost.c     (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -249,6 +249,8 @@
                                return HANDLER_GO_ON;
                        } else {
@@ -446,9 +526,17 @@
                        buffer_copy_string_buffer(con->server_name, 
con->uri.authority);
 Index: src/mod_proxy.c
 ===================================================================
---- src/mod_proxy.c    (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_proxy.c    (.../branches/lighttpd-1.4.x)   (revision 2371)
-@@ -652,7 +652,7 @@
+--- src/mod_proxy.c    (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_proxy.c    (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -454,6 +454,7 @@
+ 
+               if (ds->value->used && ds->key->used) {
+                       if (buffer_is_equal_string(ds->key, 
CONST_STR_LEN("Connection"))) continue;
++                      if (buffer_is_equal_string(ds->key, 
CONST_STR_LEN("Proxy-Connection"))) continue;
+ 
+                       buffer_append_string_buffer(b, ds->key);
+                       buffer_append_string_len(b, CONST_STR_LEN(": "));
+@@ -652,7 +653,7 @@
                        buffer_prepare_append(hctx->response, b + 1);
                        hctx->response->used = 1;
                } else {
@@ -457,7 +545,7 @@
                }
  
                if (-1 == (r = read(hctx->fd, hctx->response->ptr + 
hctx->response->used - 1, b))) {
-@@ -1198,7 +1198,8 @@
+@@ -1198,7 +1199,8 @@
                host = (data_proxy *)extension->value->data[0];
  
                /* Use last_used_ndx from first host in list */
@@ -470,12 +558,19 @@
 Index: src/config.h.cmake
 ===================================================================
 --- src/config.h.cmake (.../tags/lighttpd-1.4.20)      (revision 0)
-+++ src/config.h.cmake (.../branches/lighttpd-1.4.x)   (revision 2371)
-@@ -0,0 +1,150 @@
++++ src/config.h.cmake (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -0,0 +1,157 @@
 +/*
 +    CMake autogenerated config.h file. Do not edit!
 +*/
 +
++/* Package details */
++#define LIGHTTPD_VERSION_ID ${LIGHTTPD_VERSION_ID}
++#define PACKAGE_NAME "${PACKAGE_NAME}"
++#define PACKAGE_VERSION "${PACKAGE_VERSION}"
++#define PACKAGE_BUILD_DATE "${PACKAGE_BUILD_DATE}"
++#define LIBRARY_DIR "${LIGHTTPD_LIBRARY_DIR}"
++
 +/* System */
 +#cmakedefine  HAVE_SYS_DEVPOLL_H
 +#cmakedefine  HAVE_SYS_EPOLL_H
@@ -622,10 +717,47 @@
 +#cmakedefine HAVE_FASTCGI_FASTCGI_H
 +
 +#cmakedefine LIGHTTPD_STATIC
+Index: src/network_freebsd_sendfile.c
+===================================================================
+--- src/network_freebsd_sendfile.c     (.../tags/lighttpd-1.4.20)      
(revision 2389)
++++ src/network_freebsd_sendfile.c     (.../branches/lighttpd-1.4.x)   
(revision 2389)
+@@ -167,6 +167,7 @@
+                               switch(errno) {
+                               case EAGAIN:
+                               case EINTR:
++                                      r = 0; /* try again later */
+                                       break;
+                               case ENOTCONN:
+                                       return -2;
+@@ -174,10 +175,7 @@
+                                       log_error_write(srv, __FILE__, 
__LINE__, "ssd", "sendfile: ", strerror(errno), errno);
+                                       return -1;
+                               }
+-                      }
+-
+-                      if (r == 0 && (errno != EAGAIN && errno != EINTR)) {
+-                              int oerrno = errno;
++                      } else if (r == 0) {
+                               /* We got an event to write but we wrote nothing
+                                *
+                                * - the file shrinked -> error
+@@ -190,12 +188,9 @@
+ 
+                               if (offset >= sce->st.st_size) {
+                                       /* file shrinked, close the connection 
*/
+-                                      errno = oerrno;
+-
+                                       return -1;
+                               }
+ 
+-                              errno = oerrno;
+                               return -2;
+                       }
+ 
 Index: src/http_auth.c
 ===================================================================
---- src/http_auth.c    (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/http_auth.c    (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/http_auth.c    (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/http_auth.c    (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -57,22 +57,25 @@
  
  static const char base64_pad = '=';
@@ -750,8 +882,8 @@
                if (NULL == (ldap = ldap_init(p->conf.auth_ldap_hostname->ptr, 
LDAP_PORT))) {
 Index: src/mod_redirect.c
 ===================================================================
---- src/mod_redirect.c (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_redirect.c (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_redirect.c (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_redirect.c (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -178,11 +178,7 @@
  
        mod_redirect_patch_connection(srv, con, p);
@@ -767,8 +899,8 @@
                pcre *match;
 Index: src/http_auth.h
 ===================================================================
---- src/http_auth.h    (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/http_auth.h    (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/http_auth.h    (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/http_auth.h    (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -63,7 +63,7 @@
  
        mod_auth_plugin_config **config_storage;
@@ -780,8 +912,8 @@
  int http_auth_basic_check(server *srv, connection *con, mod_auth_plugin_data 
*p, array *req, buffer *url, const char *realm_str);
 Index: src/mod_webdav.c
 ===================================================================
---- src/mod_webdav.c   (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_webdav.c   (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_webdav.c   (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_webdav.c   (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -1026,6 +1026,8 @@
                                if (MAP_FAILED == (c->file.mmap.start = mmap(0, 
c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
                                        log_error_write(srv, __FILE__, 
__LINE__, "ssbd", "mmap failed: ",
@@ -802,8 +934,8 @@
                                        }
 Index: src/mod_compress.c
 ===================================================================
---- src/mod_compress.c (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_compress.c (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_compress.c (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_compress.c (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -49,6 +49,7 @@
        buffer *compress_cache_dir;
        array  *compress;
@@ -896,7 +1028,47 @@
                        }
                }
        }
-@@ -668,27 +709,21 @@
+@@ -619,6 +660,7 @@
+       size_t m;
+       off_t max_fsize;
+       stat_cache_entry *sce = NULL;
++      buffer *mtime = NULL;
+ 
+       if (con->mode != DIRECT || con->http_status) return HANDLER_GO_ON;
+ 
+@@ -636,8 +678,30 @@
+ 
+       max_fsize = p->conf.compress_max_filesize;
+ 
+-      stat_cache_get_entry(srv, con, con->physical.path, &sce);
++      if (con->conf.log_request_handling) {
++              log_error_write(srv, __FILE__, __LINE__,  "s",  "-- handling 
file as static file");
++      }
+ 
++      if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, 
&sce)) {
++              con->http_status = 403;
++
++              log_error_write(srv, __FILE__, __LINE__, "sbsb",
++                              "not a regular file:", con->uri.path,
++                              "->", con->physical.path);
++
++              return HANDLER_FINISHED;
++      }
++
++      /* we only handle regular files */
++#ifdef HAVE_LSTAT
++      if ((sce->is_symlink == 1) && !con->conf.follow_symlink) {
++              return HANDLER_GO_ON;
++      }
++#endif
++      if (!S_ISREG(sce->st.st_mode)) {
++              return HANDLER_GO_ON;
++      }
++
+       /* don't compress files that are too large as we need to much time to 
handle them */
+       if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return 
HANDLER_GO_ON;
+ 
+@@ -668,27 +732,21 @@
                        if (NULL != (ds = (data_string 
*)array_get_element(con->request.headers, "Accept-Encoding"))) {
                                int accept_encoding = 0;
                                char *value = ds->value->ptr;
@@ -929,10 +1101,92 @@
  
                                if (matched_encodings) {
                                        const char *dflt_gzip = "gzip";
+@@ -698,6 +756,17 @@
+                                       const char *compression_name = NULL;
+                                       int compression_type = 0;
+ 
++                                      mtime = strftime_cache_get(srv, 
sce->st.st_mtime);
++
++                                      /* try matching original etag of 
uncompressed version */
++                                      etag_mutate(con->physical.etag, 
sce->etag);
++                                      if (HANDLER_FINISHED == 
http_response_handle_cachable(srv, con, mtime)) {
++                                              response_header_overwrite(srv, 
con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
++                                              response_header_overwrite(srv, 
con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
++                                              response_header_overwrite(srv, 
con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++                                              return HANDLER_FINISHED;
++                                      }
++
+                                       /* select best matching encoding */
+                                       if (matched_encodings & 
HTTP_ACCEPT_ENCODING_BZIP2) {
+                                               compression_type = 
HTTP_ACCEPT_ENCODING_BZIP2;
+@@ -710,41 +779,34 @@
+                                               compression_name = dflt_deflate;
+                                       }
+ 
+-                                      /* deflate it */
+-                                      if (p->conf.compress_cache_dir->used) {
+-                                              if (0 == 
deflate_file_to_file(srv, con, p,
+-                                                                            
con->physical.path, sce, compression_type)) {
+-                                                      buffer *mtime;
++                                      /* try matching etag of compressed 
version */
++                                      buffer_copy_string_buffer(srv->tmp_buf, 
sce->etag);
++                                      buffer_append_string_len(srv->tmp_buf, 
CONST_STR_LEN("-"));
++                                      buffer_append_string(srv->tmp_buf, 
compression_name);
++                                      etag_mutate(con->physical.etag, 
srv->tmp_buf);
+ 
+-                                                      
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Encoding"), 
compression_name, strlen(compression_name));
+-
+-                                                      mtime = 
strftime_cache_get(srv, sce->st.st_mtime);
+-                                                      
response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), 
CONST_BUF_LEN(mtime));
+-
+-                                                      
etag_mutate(con->physical.etag, sce->etag);
+-                                                      
response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), 
CONST_BUF_LEN(con->physical.etag));
+-
+-                                                      
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), 
CONST_BUF_LEN(sce->content_type));
+-
+-                                                      return HANDLER_GO_ON;
+-                                              }
+-                                      } else if (0 == 
deflate_file_to_buffer(srv, con, p,
+-                                                                             
con->physical.path, sce, compression_type)) {
+-                                              buffer *mtime;
+-
++                                      if (HANDLER_FINISHED == 
http_response_handle_cachable(srv, con, mtime)) {
+                                               response_header_overwrite(srv, 
con, CONST_STR_LEN("Content-Encoding"), compression_name, 
strlen(compression_name));
+-
+-                                              mtime = strftime_cache_get(srv, 
sce->st.st_mtime);
++                                              response_header_overwrite(srv, 
con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+                                               response_header_overwrite(srv, 
con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
+-
+-                                              etag_mutate(con->physical.etag, 
sce->etag);
+                                               response_header_overwrite(srv, 
con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
+-
+-                                              response_header_overwrite(srv, 
con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
+-
+                                               return HANDLER_FINISHED;
+                                       }
+-                                      break;
++
++                                      /* deflate it */
++                                      if (p->conf.compress_cache_dir->used) {
++                                              if (0 != 
deflate_file_to_file(srv, con, p, con->physical.path, sce, compression_type))
++                                                      return HANDLER_GO_ON;
++                                      } else {
++                                              if (0 != 
deflate_file_to_buffer(srv, con, p, con->physical.path, sce, compression_type))
++                                                      return HANDLER_GO_ON;
++                                      }
++                                      response_header_overwrite(srv, con, 
CONST_STR_LEN("Content-Encoding"), compression_name, strlen(compression_name));
++                                      response_header_overwrite(srv, con, 
CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime));
++                                      response_header_overwrite(srv, con, 
CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag));
++                                      response_header_overwrite(srv, con, 
CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type));
++                                      /* let mod_staticfile handle the cached 
compressed files, physical path was modified */
++                                      return p->conf.compress_cache_dir->used 
? HANDLER_GO_ON : HANDLER_FINISHED;
+                               }
+                       }
+               }
 Index: src/spawn-fcgi.c
 ===================================================================
---- src/spawn-fcgi.c   (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/spawn-fcgi.c   (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/spawn-fcgi.c   (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/spawn-fcgi.c   (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -58,7 +58,7 @@
  
  
@@ -963,8 +1217,8 @@
  
 Index: src/mod_auth.c
 ===================================================================
---- src/mod_auth.c     (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_auth.c     (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_auth.c     (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_auth.c     (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -115,7 +115,7 @@
        PATCH(auth_ldap_starttls);
        PATCH(auth_ldap_allow_empty_pw);
@@ -1004,8 +1258,8 @@
  
 Index: src/http-header-glue.c
 ===================================================================
---- src/http-header-glue.c     (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/http-header-glue.c     (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/http-header-glue.c     (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/http-header-glue.c     (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -280,6 +280,7 @@
                                                strncpy(buf, 
con->request.http_if_modified_since, used_len);
                                                buf[used_len] = '\0';
@@ -1024,8 +1278,8 @@
                                 * parsing failed, let's get out of here 
 Index: src/mod_fastcgi.c
 ===================================================================
---- src/mod_fastcgi.c  (.../tags/lighttpd-1.4.20)      (revision 2371)
-+++ src/mod_fastcgi.c  (.../branches/lighttpd-1.4.x)   (revision 2371)
+--- src/mod_fastcgi.c  (.../tags/lighttpd-1.4.20)      (revision 2389)
++++ src/mod_fastcgi.c  (.../branches/lighttpd-1.4.x)   (revision 2389)
 @@ -3252,6 +3252,7 @@
                                fcgi_connection_close(srv, hctx);
  
@@ -1126,8 +1380,8 @@
 Index: src/CMakeLists.txt
 ===================================================================
 --- src/CMakeLists.txt (.../tags/lighttpd-1.4.20)      (revision 0)
-+++ src/CMakeLists.txt (.../branches/lighttpd-1.4.x)   (revision 2371)
-@@ -0,0 +1,604 @@
++++ src/CMakeLists.txt (.../branches/lighttpd-1.4.x)   (revision 2389)
+@@ -0,0 +1,598 @@
 +INCLUDE(CheckCSourceCompiles)
 +INCLUDE(CheckIncludeFiles)
 +INCLUDE(CheckFunctionExists)
@@ -1489,12 +1743,10 @@
 +  CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
 +ENDIF(HAVE_DLFCN_H)
 +
-+ADD_DEFINITIONS(
-+  -DLIGHTTPD_VERSION_ID=10400
-+  -DPACKAGE_NAME="\\"${CMAKE_PROJECT_NAME}\\""
-+  -DPACKAGE_VERSION="\\"${CPACK_PACKAGE_VERSION}\\""
-+  -DPACKAGE_BUILD_DATE="\\"-\\""
-+  )
++SET(LIGHTTPD_VERSION_ID 10400)
++SET(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
++SET(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
++EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE 
PACKAGE_BUILD_DATE)
 +
 +IF(NOT SBINDIR)
 +    SET(SBINDIR "sbin")
@@ -1505,14 +1757,10 @@
 +ENDIF(NOT LIGHTTPD_MODULES_DIR)
 +
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lighttpd-branch.diff?r1=1.43&r2=1.44&f=u

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to