--- embedaddon/lighttpd/src/mod_expire.c 2013/10/14 10:32:47 1.1.1.1 +++ embedaddon/lighttpd/src/mod_expire.c 2014/06/15 20:20:06 1.1.1.2 @@ -221,7 +221,7 @@ SETDEFAULTS_FUNC(mod_expire_set_defaults) { if (!p) return HANDLER_ERROR; - p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); + p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { plugin_config *s; @@ -306,7 +306,8 @@ URIHANDLER_FUNC(mod_expire_path_handler) { size_t len; stat_cache_entry *sce = NULL; - stat_cache_get_entry(srv, con, con->physical.path, &sce); + /* if stat fails => sce == NULL, ignore return value */ + (void) stat_cache_get_entry(srv, con, con->physical.path, &sce); switch(mod_expire_get_offset(srv, p, ds->value, &ts)) { case 0: @@ -316,11 +317,16 @@ URIHANDLER_FUNC(mod_expire_path_handler) { case 1: /* modification */ + /* can't set modification based expire header if + * mtime is not available + */ + if (NULL == sce) return HANDLER_GO_ON; + expires = (ts + sce->st.st_mtime); break; default: /* -1 is handled at parse-time */ - break; + return HANDLER_ERROR; } /* expires should be at least srv->cur_ts */