httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minty <mintywal...@gmail.com>
Subject [users@httpd] setting cookies via mod_rewrite, with path but not expires
Date Mon, 08 Aug 2005 11:42:59 GMT
I'm trying to use a RewriteRule in an htaccess file to set a cookie,
such that the path value *is* set, but the cookie expires at the end
of the browser session.  Aka, I do *not* want to explicitly set the
lifetime/expires value.

Hence I have something like:

  RewriteRule ^index.shtml$ /some/other.shtml \
  [CO=myname:myvalue:mydomain.com::/some/path,R]

(note the :: between domain and path - I'm after a null value for the
lifetime/expires field)

But this doesn't appear to work.  From looking at the source [2], I'm
concluding it just ain't possible:

  static void add_cookie(request_rec *r, char *s)
    ...
    expires = apr_strtok(NULL, ":", &tok_cntx);
    if (expires) { path = apr_strtok(NULL,":", &tok_cntx); }
    else { path = NULL; }
    ...
    cookie = apr_pstrcat(rmain->pool,
      var, "=", val,
      "; path=", (path)? path : "/",
      "; domain=", domain,
      (expires)? "; expires=" : NULL,

Anyone know if this can be done?

I realise there are other ways to get cookies set - I'm specifically
wanting to do this in a RewriteRule if possible.

[1] http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
[2] ~/modules/mappers/mod_rewrite.c

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message