[users@httpd] setting cookies via mod_rewrite, with path but not expires

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux