You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/05/16 06:17:41 UTC

svn commit: r170299 - in /httpd/apreq/trunk: CHANGES glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h

Author: joes
Date: Sun May 15 21:17:40 2005
New Revision: 170299

URL: http://svn.apache.org/viewcvs?rev=170299&view=rev
Log:
Cookie parents can be either pools or handles, so we need
to check for this in the mutator APIs.

Modified:
    httpd/apreq/trunk/CHANGES
    httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h

Modified: httpd/apreq/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/CHANGES?rev=170299&r1=170298&r2=170299&view=diff
==============================================================================
--- httpd/apreq/trunk/CHANGES (original)
+++ httpd/apreq/trunk/CHANGES Sun May 15 21:17:40 2005
@@ -5,6 +5,9 @@
 @section v2_06 Changes with libapreq2-2.06
 
 
+- Perl API [joes]
+  Fix cookie domain/path munging in Apache2::Cookie::new().
+
 
 @section v2_05_dev Changes with libapreq2-2.05-dev (released May 5, 2005)
 

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h?rev=170299&r1=170298&r2=170299&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/APR__Request__Cookie.h Sun May 15 21:17:40 2005
@@ -181,18 +181,34 @@
     XSRETURN_EMPTY;
 }
 
-static APR_INLINE
-char *apreq_xs_cookie_pool_copy(pTHX_ SV *obj, SV *value)
+static char *apreq_xs_cookie_pool_copy(pTHX_ SV *obj, SV *value)
 {
     IV iv;
     STRLEN vlen;
     char *v;
     MAGIC *mg;
     apr_pool_t *p;
+    SV *parent;
 
     v = SvPV(value, vlen);
     mg = mg_find(obj, PERL_MAGIC_ext);
     iv = SvIVX(mg->mg_obj);
-    p = INT2PTR(apr_pool_t *, iv);
+
+    /* The parent of a cookie can be a either handle or a pool.
+     * Pool-type parents arise from make(), and are expected to
+     * reflect the typical usage for apreq_xs_cookie_pool_copy.
+     */
+    parent = sv_2mortal(newRV_inc(mg->mg_obj));
+
+    if (sv_derived_from(parent, "APR::Pool"))
+        p = INT2PTR(apr_pool_t *, iv);
+
+    else if (sv_derived_from(parent, "APR::Request"))
+        p = (INT2PTR(apreq_handle_t *, iv))->pool;
+
+    else
+        croak("Pool not found: unrecognized parent class %s",
+              HvNAME(SvSTASH(mg->mg_obj)));
+
     return apr_pstrmemdup(p, v, vlen);
 }