]> granicus.if.org Git - apache/commitdiff
* Offer the possibility to create session cookies in the case a path is
authorRuediger Pluem <rpluem@apache.org>
Sat, 7 Jun 2008 12:50:04 +0000 (12:50 +0000)
committerRuediger Pluem <rpluem@apache.org>
Sat, 7 Jun 2008 12:50:04 +0000 (12:50 +0000)
  given.

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

docs/manual/mod/mod_rewrite.xml
modules/mappers/mod_rewrite.c

index 2a66f4d3319b19d5ae522f6b4347cddf40c0fad0..baa6038dca6b913c433341589e499e022010b8ad 100644 (file)
@@ -1257,7 +1257,8 @@ cannot use <code>$N</code> in the substitution string!
         is specified by <em>NAME</em> and the value is
         <em>VAL</em>. The <em>domain</em> field is the domain of the
         cookie, such as '.apache.org', the optional <em>lifetime</em>
-        is the lifetime of the cookie in minutes, and the optional 
+        is the lifetime of the cookie in minutes (0 means expires at end
+        of session), and the optional
         <em>path</em> is the path of the cookie. If <em>secure</em>
         is set to 'secure', 'true' or '1', the cookie is only transmitted via secured
         connections. If <em>httponly</em> is set to 'HttpOnly', 'true' or '1', the
index 10e50dd9bf9b0a15ce02a67d6cc6b7e59b59b73d..73379caeb0d1c24e4d2e5d9956f0b55430f05a0b 100644 (file)
@@ -2475,23 +2475,30 @@ static void add_cookie(request_rec *r, char *s)
 
             if (expires) {
                 apr_time_exp_t tms;
-                apr_time_exp_gmt(&tms, r->request_time
-                                     + apr_time_from_sec((60 * atol(expires))));
-                exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
-                                                 "%.2d:%.2d:%.2d GMT",
-                                        apr_day_snames[tms.tm_wday],
-                                        tms.tm_mday,
-                                        apr_month_snames[tms.tm_mon],
-                                        tms.tm_year+1900,
-                                        tms.tm_hour, tms.tm_min, tms.tm_sec);
+                long exp_min;
+
+                exp_min = atol(expires);
+                if (exp_min) {
+                    apr_time_exp_gmt(&tms, r->request_time
+                                     + apr_time_from_sec((60 * exp_min)));
+                    exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
+                                                     "%.2d:%.2d:%.2d GMT",
+                                           apr_day_snames[tms.tm_wday],
+                                           tms.tm_mday,
+                                           apr_month_snames[tms.tm_mon],
+                                           tms.tm_year+1900,
+                                           tms.tm_hour, tms.tm_min, tms.tm_sec);
+                }
             }
 
             cookie = apr_pstrcat(rmain->pool,
                                  var, "=", val,
                                  "; path=", path ? path : "/",
                                  "; domain=", domain,
-                                 expires ? "; expires=" : NULL,
-                                 expires ? exp_time : NULL,
+                                 expires ? (exp_time ? "; expires=" : "")
+                                 : NULL,
+                                 expires ? (exp_time ? exp_time : "")
+                                 : NULL,
                                  (secure && (!strcasecmp(secure, "true")
                                              || !strcmp(secure, "1")
                                              || !strcasecmp(secure,