From: Ian Holsman Date: Thu, 29 Aug 2002 23:14:52 +0000 (+0000) Subject: new option 'path' to the cookie X-Git-Tag: AGB_BEFORE_AAA_CHANGES~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da6a8884aad82d17de8688f136bbf0c86bf0aca1;p=apache new option 'path' to the cookie PR: 12172 Submitted by: apachecvslog@robcromwell.com (Rob Cromwell) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96581 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index cc00f63c74..1ca195a65c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,8 @@ Changes with Apache 2.0.41 - *) mod_rewrite can now sets cookies in err_headers, and uses the correct - expiry date. PR 12132 + *) mod_rewrite can now sets cookies in err_headers, uses the correct + expiry date, and can now set the path as well + PR 12132,12181,12172. [Ian Holsman / Rob Cromwell ] *) The content-length filter no longer tries to buffer up diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index b2334554ec..8e6afcdbae 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -1611,13 +1611,14 @@ There is a special feature: information from URLs.
  • - 'cookie|CO=NAME:VAL:domain[:lifetime]' + 'cookie|CO=NAME:VAL:domain[:lifetime[:path]]' (set cocookie)
    This sets a cookie on the client's browser. The cookie's name is specified by NAME and the value is VAL. The domain field is the domain of the - cookie, such as '.apache.org' and the optional lifetime - is the lifetime of the cookie in minutes.
  • + cookie, such as '.apache.org',the optional lifetime + is the lifetime of the cookie in minutes, and the optional + path is the path of the cookie diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index c9b918669e..c39ae6de41 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -4134,6 +4134,7 @@ static void add_cookie(request_rec *r, char *s) char *val; char *domain; char *expires; + char *path; char *tok_cntx; char *cookie; @@ -4144,6 +4145,12 @@ static void add_cookie(request_rec *r, char *s) domain = apr_strtok(NULL, ":", &tok_cntx); /** the line below won't hit the token ever **/ expires = apr_strtok(NULL, ":", &tok_cntx); + if (expires) { + path = apr_strtok(NULL,":", &tok_cntx); + } + else { + path = NULL; + } if (var && val && domain) { /* FIX: use cached time similar to how logging does it */ @@ -4161,7 +4168,9 @@ static void add_cookie(request_rec *r, char *s) var, "=", val, - "; path=/; domain=", + "; path=", + (path)? path : "/", + "; domain=", domain, (expires)? "; expires=" : NULL, (expires)?