httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Thu, 29 Aug 2002 22:45:13 GMT
ianh        2002/08/29 15:45:13

  Modified:    .        CHANGES
               modules/mappers mod_rewrite.c
  Log:
  set expiry time correctly.
  set Cookie on err_headers_out, and ensure it is only set once.
  
  PR: 12132
  Submitted by:	apachecvslog@robcromwell.com (Rob Cromwell)
  
  Revision  Changes    Path
  1.905     +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.904
  retrieving revision 1.905
  diff -u -r1.904 -r1.905
  --- CHANGES	28 Aug 2002 18:37:48 -0000	1.904
  +++ CHANGES	29 Aug 2002 22:45:12 -0000	1.905
  @@ -1,5 +1,9 @@
   Changes with Apache 2.0.41
   
  +  *) mod_rewrite can now sets cookies in err_headers, and uses the correct
  +     expiry date. PR 12132 
  +     [Ian Holsman / Rob Cromwell <apachechangelog@robcromwell.com>]
  +
     *) The content-length filter no longer tries to buffer up
        the entire output of a long-running request before sending
        anything to the client.  [Brian Pane]
  
  
  
  1.129     +35 -20    httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- mod_rewrite.c	23 Aug 2002 18:51:44 -0000	1.128
  +++ mod_rewrite.c	29 Aug 2002 22:45:13 -0000	1.129
  @@ -4147,27 +4147,42 @@
   
           if (var && val && domain) {
               /* FIX: use cached time similar to how logging does it */
  -            cookie = apr_pstrcat( r->pool, 
  -                                  var,
  -                                  "=",
  -                                  val,
  -                                  "; path=/; domain=",
  -                                  domain,
  -                                  (expires)? "; expires=" : NULL,
  -                                  (expires)? ap_ht_time(r->pool, 
  -                                                        r->request_time + 
  -                                                        (60 * atol(expires)),
  -                                                         "%a, %d-%b-%Y %T GMT", 1)
  -                                           : NULL, 
  -                                  NULL);
  -
  +            request_rec *rmain = r;
  +            char *notename;
  +            char *data;
  +            while (rmain->main) {
  +                rmain = rmain->main;
  +            }
               
  -            /* 
  -             * XXX: should we add it to err_headers_out as well ?
  -             * if we do we need to be careful that only ONE gets sent out
  -             */
  -            apr_table_add(r->headers_out, "Set-Cookie", cookie);
  -            rewritelog(r, 5, "setting cookie '%s' to '%s'", var, val);
  +            notename = apr_pstrcat(rmain->pool, var, "_rewrite", NULL);
  +            apr_pool_userdata_get( &data, notename, rmain->pool);
  +            if  (data== NULL) {
  +               cookie = apr_pstrcat(rmain->pool, 
  +                                    var,
  +                                    "=",
  +                                    val,
  +                                    "; path=/; domain=",
  +                                    domain,
  +                                    (expires)? "; expires=" : NULL,
  +                                    (expires)? 
  +                                     ap_ht_time(r->pool, 
  +                                                r->request_time + 
  +                                                apr_time_from_sec((60 *
  +                                                               atol(expires))),
  +                                                "%a, %d-%b-%Y %T GMT", 1)
  +                                           : NULL, 
  +                                  NULL);                   
  +                /* 
  +                * XXX: should we add it to err_headers_out as well ?
  +                * if we do we need to be careful that only ONE gets sent out
  +                */
  +                apr_table_add(rmain->err_headers_out, "Set-Cookie", cookie);
  +                apr_pool_userdata_set("set", notename, NULL, rmain->pool);
  +                rewritelog(rmain, 5, "setting cookie '%s' to '%s'", var, val);
  +            }
  +            else {
  +                rewritelog(rmain, 5, "cookie '%s' is already set..skipping", var);
  +            }
           }
       }
   }
  
  
  

Mime
View raw message