]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* modules/cache/mod_socache_memcache.c (socache_mc_store): Pass
authorJoe Orton <jorton@apache.org>
Mon, 5 Jan 2015 10:06:29 +0000 (10:06 +0000)
committerJoe Orton <jorton@apache.org>
Mon, 5 Jan 2015 10:06:29 +0000 (10:06 +0000)
  through expiration time.

Submitted by: Faidon Liambotis <paravoid debian.org>, jorton

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1649491 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/mod_socache_memcache.c

diff --git a/CHANGES b/CHANGES
index b3c9af7518329c1dec6796fbb0d5869fa3a18019..52ac22360a8eb263e229bc9e8edeb4ce909ad32e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_socache_memcache: Pass expiration time through to memcached.
+     [Faidon Liambotis <paravoid debian.org>, Joe Orton]
+
   *) split-logfile: Fix perl error:  'Can't use string ("example.org:80") 
      as a symbol ref while "strict refs"'. PR 56329.
      [Holger Mauermann <mauermann gmail.com>]
index 8cabd8a50ba7b3dcf58e8ff5dc28f044dceefeb8..b05b6ed36f8225b177f79e7af98bda66d2b36ba1 100644 (file)
@@ -205,8 +205,14 @@ static apr_status_t socache_mc_store(ap_socache_instance_t *ctx, server_rec *s,
         return APR_EINVAL;
     }
 
-    /* In APR-util - unclear what 'timeout' is, as it was not implemented */
-    rv = apr_memcache_set(ctx->mc, buf, (char*)ucaData, nData, 0, 0);
+    /* memcache needs time in seconds till expiry; fail if this is not
+     * positive *before* casting to unsigned (apr_uint32_t). */
+    expiry -= apr_time_now();
+    if (apr_time_sec(expiry) <= 0) {
+        return APR_EINVAL;
+    }
+    rv = apr_memcache_set(ctx->mc, buf, (char*)ucaData, nData,
+                          apr_time_sec(expiry), 0);
 
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, APLOGNO(00790)