httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/glue/perl/xsbuilder/maps apreq_functions.map
Date Thu, 22 Jul 2004 03:29:09 GMT
joes        2004/07/21 20:29:09

  Modified:    glue/perl/xsbuilder apreq_xs_postperl.h apreq_xs_tables.h
               glue/perl/xsbuilder/Apache/Cookie Apache__Cookie.h Cookie_pm
               glue/perl/xsbuilder/Apache/Request Apache__Request.h
                        Request_pm
               glue/perl/xsbuilder/Apache/Upload Apache__Upload.h
               glue/perl/xsbuilder/maps apreq_functions.map
  Log:
  Jars shouldn't derive from Apache::RequestRec.  This frees up their mg_ptr for more traditional
uses, so we take advantage of that by adding a VALUE_CLASS argument to Apache::Cookie::Jar->new.
 Setting this argument to a subclass of Apache::Cookie configures the jar's cookies() api
to return values in this derived class, (instead of Apache::Cookie).  This should make the
new freeze/thaw API for Apache::Cookie-derived classes considerably more useful.  Also Apache::Request
cannot safely derive from APR::Pool class, so we only modify its base class in the mp2 case
(Apache::RequestRec).
  
  Revision  Changes    Path
  1.42      +49 -24    httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h
  
  Index: apreq_xs_postperl.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- apreq_xs_postperl.h	13 Jul 2004 01:00:07 -0000	1.41
  +++ apreq_xs_postperl.h	22 Jul 2004 03:29:08 -0000	1.42
  @@ -89,19 +89,22 @@
           return (void *)SvIVX(sv);
   }
   
  -/** 
  - * Searches a perl object ref with apreq_xs_find_obj
  - * and produces a pointer to the underlying C environment.
  - */ 
   APR_INLINE
  -static void *apreq_xs_perl2env(pTHX_ SV *sv)
  +static SV *apreq_xs_perl_sv2env(pTHX_ SV *sv)
   {
       MAGIC *mg;
  -    if (sv != NULL && (mg = mg_find(sv, PERL_MAGIC_ext)))
  -        return mg->mg_ptr;
  -    return NULL;
  +    if ((mg = mg_find(sv, PERL_MAGIC_ext)) && SvROK(mg->mg_obj))
  +        return mg->mg_obj;
  +
  +    Perl_croak(aTHX_ "Can't find magic environment");
  +    return NULL; /* not reached */
   }
   
  +/** 
  + * Searches a perl object ref with apreq_xs_find_obj
  + * and produces a pointer to the underlying C environment.
  + */ 
  +
   /**
    * Converts a C object, with environment, to a Perl object.
    * @param obj C object.
  @@ -135,7 +138,7 @@
   #define apreq_xs_sv2(type,sv)((apreq_##type##_t *)      \
                                  apreq_xs_perl2c(aTHX_ sv, #type))
   
  -#define apreq_xs_sv2env(sv) apreq_xs_perl2env(aTHX_ sv)
  +#define apreq_xs_sv2env(sv) ((void *)SvIVX(SvRV(apreq_xs_perl_sv2env(aTHX_ sv))))
   
   /** Converts apreq_env to a Perl package, which forms the
    * base class for Apache::Request and Apache::Cookie::Jar objects.
  @@ -151,6 +154,8 @@
                                                           \
       if (strcmp(apreq_env_name, "APACHE2") == 0)         \
           class = "Apache::RequestRec";                   \
  +    else if (strcmp(apreq_env_name, "CGI") == 0)        \
  +        class = "APR::Pool";                            \
                                                           \
       /* else if ... add more conditionals here as        \
          additional environments become supported */      \
  @@ -175,26 +180,44 @@
   }
   
   
  -/** requires apreq_##type (type is either request or jar) */
   
  -#define APREQ_XS_DEFINE_OBJECT(type)                                    \
  -static XS(apreq_xs_##type)                                              \
  +#define APREQ_XS_DEFINE_CONFIG(attr)                                    \
  +static XS(apreq_xs_##attr##_config)                                     \
   {                                                                       \
       dXSARGS;                                                            \
  -    void *env;                                                          \
  -    const char *data;                                                   \
  -    apreq_##type##_t *obj;                                              \
  +    SV *sv, *obj;                                                       \
  +    int j;                                                              \
                                                                           \
  -    if (items < 2 || SvROK(ST(0)) || !SvROK(ST(1)))                     \
  -        Perl_croak(aTHX_ "Usage: $class->" #type "($env, $data)");      \
  +    if (items % 2 != 1 || !SvROK(ST(0)))                                \
  +        Perl_croak(aTHX_ "usage: $obj->config(%settings)");             \
                                                                           \
  -    env = (void *)SvIVX(SvRV(ST(1)));                                   \
  -    data = (items == 3)  ?  SvPV_nolen(ST(2)) :  NULL;                  \
  -    obj = apreq_##type(env, data);                                      \
  +    sv = ST(0);                                                         \
  +    obj = apreq_xs_find_obj(aTHX_ sv, #attr);                           \
                                                                           \
  -    ST(0) = obj ? sv_2mortal(apreq_xs_2sv(obj, SvPV_nolen(ST(0)),ST(1)))\
  -                : &PL_sv_undef;                                         \
  -    XSRETURN(1);                                                        \
  +    for (j = 1; j + 1 < items; j += 2) {                                \
  +        STRLEN alen;                                                    \
  +        const char *attr = SvPVbyte(ST(j),alen);                        \
  +                                                                        \
  +        if (strcasecmp(attr,"VALUE_CLASS") == 0)                        \
  +        {                                                               \
  +            STRLEN vlen;                                                \
  +            const char *val = SvPV(ST(j+1), vlen);                      \
  +            MAGIC *mg = mg_find(obj, PERL_MAGIC_ext);                   \
  +                                                                        \
  +            if (mg->mg_len > 0) {                                       \
  +                Safefree(mg->mg_ptr);                                   \
  +            }                                                           \
  +            mg->mg_ptr = savepvn(val, vlen);                            \
  +            mg->mg_len = vlen;                                          \
  +                                                                        \
  +        }                                                               \
  +        else {                                                          \
  +            Perl_warn(aTHX_ "$obj->config(%settings): "                 \
  +                      "Unrecognized attribute %s, skipped", attr);      \
  +        }                                                               \
  +    }                                                                   \
  +                                                                        \
  +    XSRETURN(0);                                                        \
   }
   
   
  @@ -253,10 +276,12 @@
   {                                                               \
       dXSARGS;                                                    \
       void *env;                                                  \
  +    SV *obj;                                                    \
                                                                   \
       if (items != 1 || !SvROK(ST(0)))                            \
           Perl_croak(aTHX_ "Usage: $obj->pool()");                \
  -    env = apreq_xs_##attr##_sv2env(SvRV(ST(0)));                \
  +    obj = apreq_xs_find_obj(aTHX_ ST(0), #attr);                \
  +    env = apreq_xs_sv2env(obj);                                 \
       ST(0) = sv_2mortal(sv_setref_pv(newSV(0), "APR::Pool",      \
                                       apreq_env_pool(env)));      \
       XSRETURN(1);                                                \
  
  
  
  1.27      +53 -54    httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h
  
  Index: apreq_xs_tables.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- apreq_xs_tables.h	20 Jul 2004 16:20:44 -0000	1.26
  +++ apreq_xs_tables.h	22 Jul 2004 03:29:08 -0000	1.27
  @@ -63,25 +63,15 @@
    * @return Reference to a new TIEHASH object in class.
    */
   APR_INLINE
  -static SV *apreq_xs_table_c2perl(pTHX_ void *obj, void *env, 
  +static SV *apreq_xs_table_c2perl(pTHX_ void *obj, const char *name, I32 nlen,
                                    const char *class, SV *parent)
   {
       SV *sv = (SV *)newHV();
       /*upgrade ensures CUR and LEN are both 0 */
       SV *rv = sv_setref_pv(newSV(0), class, obj);
  -    if (env) {
  -        /* We use the old idiom for sv_magic() below,
  -         * because perl 5.6 mangles the env pointer on
  -         * the recommended 5.8.x invocation
  -         *
  -         *   sv_magic(SvRV(rv), Nullsv, PERL_MAGIC_ext, env, 0);
  -         *
  -         * 5.8.x is OK with the old way as well, but in the future
  -         * we may have to use "#if PERL_VERSION < 8" ...
  -         */
  -        sv_magic(SvRV(rv), parent, PERL_MAGIC_ext, Nullch, -1);
  -        SvMAGIC(SvRV(rv))->mg_ptr = env;
  -    }
  +
  +    sv_magic(SvRV(rv), parent, PERL_MAGIC_ext, name, nlen);
  +
   
   #if (PERL_VERSION >= 8) /* MAGIC ITERATOR requires 5.8 */
   
  @@ -99,31 +89,32 @@
   
   
   #define apreq_xs_sv2table(sv)      ((apr_table_t *) SvIVX(SvRV(sv)))
  -#define apreq_xs_table2sv(t,class,parent)                               \
  -                  apreq_xs_table_c2perl(aTHX_ t, env, class, parent)
  +#define apreq_xs_table2sv(t,class,parent,name)          \
  +     apreq_xs_table_c2perl(aTHX_ t, name, name ? strlen(name) : 0, class, parent)
   
   
  -#define APREQ_XS_DEFINE_TABLE_MAKE(attr)                        \
  -static XS(apreq_xs_table_##attr##_make)                         \
  -{                                                               \
  -                                                                \
  -    dXSARGS;                                                    \
  -    apreq_##attr##_t *obj;                                      \
  -    void *env;                                                  \
  -    const char *class;                                          \
  -    apr_table_t *t;                                             \
  -                                                                \
  -    if (items != 2 || !SvPOK(ST(0)) || !SvROK(ST(1)))           \
  -        Perl_croak(aTHX_ "Usage: $class->make($object)");       \
  -                                                                \
  -                                                                \
  -    class = SvPV_nolen(ST(0));                                  \
  -    obj = apreq_xs_sv2(attr,ST(1));                             \
  -    env = obj->env;                                             \
  -    t = apr_table_make(apreq_env_pool(env), APREQ_NELTS);       \
  -                                                                \
  -    ST(0) = apreq_xs_table_c2perl(aTHX_ t, env, class, ST(1));  \
  -    XSRETURN(1);                                                \
  +#define APREQ_XS_DEFINE_TABLE_MAKE(attr,pkg)                            \
  +static XS(apreq_xs_table_##attr##_make)                                 \
  +{                                                                       \
  +                                                                        \
  +    dXSARGS;                                                            \
  +    SV *sv;                                                             \
  +    apreq_##attr##_t *obj;                                              \
  +    void *env;                                                          \
  +    const char *class;                                                  \
  +    apr_table_t *t;                                                     \
  +                                                                        \
  +    if (items != 2 || !SvPOK(ST(0)) || !SvROK(ST(1)))                   \
  +        Perl_croak(aTHX_ "Usage: $class->make($object)");               \
  +                                                                        \
  +                                                                        \
  +    class = SvPV_nolen(ST(0));                                          \
  +    obj = apreq_xs_sv2(attr,ST(1));                                     \
  +    env = obj->env;                                                     \
  +    t = apr_table_make(apreq_env_pool(env), APREQ_NELTS);               \
  +    sv = apreq_xs_table2sv(t, class, ST(1), pkg);                       \
  +    ST(0) = sv_2mortal(sv);                                             \
  +    XSRETURN(1);                                                        \
   }
   
   #define APREQ_XS_DEFINE_TABLE_METHOD_N(attr,method)                     \
  @@ -195,6 +186,7 @@
   
   struct apreq_xs_do_arg {
       void            *env;
  +    const char      *pkg;
       SV              *parent, *sub;
       PerlInterpreter *perl;
   };
  @@ -256,7 +248,7 @@
                             apreq_value_to_##type(apreq_strtoval(val));   \
           if (COND)                                                       \
               XPUSHs(sv_2mortal(                                          \
  -                   apreq_xs_##type##2sv(RETVAL,subclass,d->parent)));   \
  +                   apreq_xs_##type##2sv(RETVAL,d->pkg,d->parent)));     \
       } else                                                              \
           XPUSHs(&PL_sv_undef);                                           \
                                                                           \
  @@ -268,10 +260,10 @@
   {                                                                       \
       dXSARGS;                                                            \
       const char *key = NULL;                                             \
  -    struct apreq_xs_do_arg d = { NULL, NULL, NULL, aTHX };              \
  +    struct apreq_xs_do_arg d = { NULL, NULL, NULL, NULL, aTHX };        \
       void *env;                                                          \
       SV *sv, *obj;                                                       \
  -                                                                        \
  +    MAGIC *mg;                                                          \
       if (items == 0 || items > 2 || !SvROK(ST(0)))                       \
           Perl_croak(aTHX_ "Usage: $object->get($key)");                  \
                                                                           \
  @@ -279,15 +271,16 @@
       obj = apreq_xs_find_obj(aTHX_ sv, #attr);                           \
       env = apreq_xs_##attr##_sv2env(obj);                                \
       d.env = env;                                                        \
  -    d.parent = obj;                                                     \
  -                                                                        \
  +    mg = mg_find(obj, PERL_MAGIC_ext);                                  \
  +    d.parent = mg->mg_obj;                                              \
  +    d.pkg = mg->mg_len > 0 ? mg->mg_ptr : subclass;                     \
       if (items == 2)                                                     \
           key = SvPV_nolen(ST(1));                                        \
                                                                           \
       XSprePUSH;                                                          \
       switch (GIMME_V) {                                                  \
           apreq_##type##_t *RETVAL;                                       \
  -        MAGIC *mg;                                                      \
  +                                                                        \
       case G_ARRAY:                                                       \
           PUTBACK;                                                        \
           apreq_xs_##attr##_push(obj, &d, key);                           \
  @@ -297,7 +290,7 @@
           if (items == 1) {                                               \
               apr_table_t *t = apreq_xs_##attr##_sv2table(obj);           \
               if (t != NULL)                                              \
  -                XPUSHs(sv_2mortal(apreq_xs_table2sv(t,class,obj)));     \
  +                XPUSHs(sv_2mortal(apreq_xs_table2sv(t,class,d.parent,d.pkg))); \
               PUTBACK;                                                    \
               break;                                                      \
           }                                                               \
  @@ -306,12 +299,12 @@
               && mg->mg_len == -1 /*&& mg->mg_obj == obj*/)       
       \
           {                                                               \
               struct apreq_xs_table_key_magic *info = (void*)mg->mg_ptr;  \
  -            if (info->obj == obj) {                                     \
  +            if (info->obj == d.parent) {                                \
                   RETVAL = apreq_value_to_##type(                         \
                                          apreq_strtoval(info->val));      \
                   if (!strcasecmp(key,RETVAL->v.name) && (COND)) {        \
                           XPUSHs(sv_2mortal(apreq_xs_##type##2sv(         \
  -                                              RETVAL,subclass,obj)));   \
  +                                              RETVAL,d.pkg,d.parent))); \
                           PUTBACK;                                        \
                           break;                                          \
                   }                                                       \
  @@ -322,7 +315,7 @@
                                                                           \
           if (RETVAL && (COND))                                           \
               XPUSHs(sv_2mortal(                                          \
  -                   apreq_xs_##type##2sv(RETVAL,subclass,obj)));         \
  +                   apreq_xs_##type##2sv(RETVAL,d.pkg,d.parent)));       \
                                                                           \
       default:                                                            \
           PUTBACK;                                                        \
  @@ -334,9 +327,10 @@
   static XS(apreq_xs_##attr##_FETCH)                              \
   {                                                               \
       dXSARGS;                                                    \
  -    SV *sv, *obj;                                               \
  +    SV *sv, *obj, *parent;                                      \
       IV idx;                                                     \
  -    const char *key;                                            \
  +    MAGIC *mg;                                                  \
  +    const char *key, *pkg;                                      \
       const char *val;                                            \
       apr_table_t *t;                                             \
       const apr_array_header_t *arr;                              \
  @@ -348,6 +342,9 @@
                                                                   \
       sv  = ST(0);                                                \
       obj = apreq_xs_find_obj(aTHX_ sv, #attr);                   \
  +    mg = mg_find(obj, PERL_MAGIC_ext);                          \
  +    parent = mg->mg_obj;                                        \
  +    pkg = mg->mg_len > 0 ? mg->mg_ptr : subclass;               \
       key = SvPV_nolen(ST(1));                                    \
       idx = SvCUR(obj);                                           \
       t   = apreq_xs_##attr##_sv2table(obj);                      \
  @@ -364,7 +361,7 @@
       if (val != NULL) {                                          \
           apreq_##type##_t *RETVAL = apreq_value_to_##type(       \
                                             apreq_strtoval(val)); \
  -        sv = apreq_xs_##type##2sv(RETVAL, subclass, obj);       \
  +        sv = apreq_xs_##type##2sv(RETVAL, pkg, parent);         \
           ST(0) = sv_2mortal(sv);                                 \
           XSRETURN(1);                                            \
       }                                                           \
  @@ -424,8 +421,7 @@
       PUSHMARK(SP);                                                       \
       EXTEND(SP,2);                                                       \
       PUSHs(sv_2mortal(newSVpv(key,0)));                                  \
  -    PUSHs(sv_2mortal(apreq_xs_##type##2sv(RETVAL, subclass,             \
  -                                           d->parent)));                \
  +    PUSHs(sv_2mortal(apreq_xs_##type##2sv(RETVAL,d->pkg,d->parent)));   \
       PUTBACK;                                                            \
       rv = call_sv(d->sub, G_SCALAR);                                     \
       SPAGAIN;                                                            \
  @@ -440,11 +436,12 @@
   static XS(apreq_xs_##attr##_do)                                         \
   {                                                                       \
       dXSARGS;                                                            \
  -    struct apreq_xs_do_arg d = { NULL, NULL, NULL, aTHX };              \
  +    struct apreq_xs_do_arg d = { NULL, NULL, NULL, NULL, aTHX };        \
       apr_table_t *t;                                                     \
       void *env;                                                          \
       int i, rv;                                                          \
       SV *sv, *obj;                                                       \
  +    MAGIC *mg;                                                          \
                                                                           \
       if (items < 2 || !SvROK(ST(0)) || !SvROK(ST(1)))                    \
           Perl_croak(aTHX_ "Usage: $object->do(\\&callback, @keys)");     \
  @@ -452,8 +449,10 @@
       obj = apreq_xs_find_obj(aTHX_ sv, #attr);                           \
       env = apreq_xs_##attr##_sv2env(obj);                                \
       t = apreq_xs_##attr##_sv2table(obj);                                \
  +    mg = mg_find(obj, PERL_MAGIC_ext);                                  \
  +    d.parent = mg->mg_obj;                                              \
  +    d.pkg = mg->mg_len > 0 ? mg->mg_ptr : subclass;                     \
       d.env = env;                                                        \
  -    d.parent = obj;                                                     \
       d.sub = ST(1);                                                      \
                                                                           \
       if (items == 2) {                                                   \
  
  
  
  1.30      +22 -2     httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h
  
  Index: Apache__Cookie.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Apache__Cookie.h	18 Jul 2004 23:24:51 -0000	1.29
  +++ Apache__Cookie.h	22 Jul 2004 03:29:08 -0000	1.30
  @@ -28,7 +28,27 @@
   APREQ_XS_DEFINE_ENV(cookie);
   APREQ_XS_DEFINE_ENV(jar);
   APREQ_XS_DEFINE_MAKE(cookie);
  -APREQ_XS_DEFINE_OBJECT(jar);
  +APREQ_XS_DEFINE_CONFIG(jar);
  +
  +static XS(apreq_xs_jar)
  +{
  +    dXSARGS;
  +    void *env;
  +    const char *data;
  +    apreq_jar_t *jar;
  +
  +    if (items < 2 || SvROK(ST(0)) || !SvROK(ST(1)))
  +        Perl_croak(aTHX_ "Usage: $class->jar($env, $data)");
  +
  +    env = (void *)SvIVX(SvRV(ST(1)));
  +    data = (items == 3)  ?  SvPV_nolen(ST(2)) :  NULL;
  +    jar = apreq_jar(env, data);
  +
  +    ST(0) = sv_2mortal(apreq_xs_2sv(jar, SvPV_nolen(ST(0)),ST(1)));
  +    XSRETURN(1);
  +}
  +
  +
   
   #define apreq_xs_jar_error_check   do {                                 \
       int n = PL_stack_sp - (PL_stack_base + ax - 1);                     \
  @@ -75,7 +95,7 @@
   APREQ_XS_DEFINE_POOL(jar);
   APREQ_XS_DEFINE_POOL(table);
   
  -APREQ_XS_DEFINE_TABLE_MAKE(jar);
  +APREQ_XS_DEFINE_TABLE_MAKE(jar, COOKIE_PKG);
   APREQ_XS_DEFINE_TABLE_METHOD_N(cookie,set);
   APREQ_XS_DEFINE_TABLE_METHOD_N(cookie,add);
   APREQ_XS_DEFINE_TABLE_NEXTKEY(table);
  
  
  
  1.21      +20 -10    httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm
  
  Index: Cookie_pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Cookie_pm	20 Jul 2004 16:20:44 -0000	1.20
  +++ Cookie_pm	22 Jul 2004 03:29:08 -0000	1.21
  @@ -1,9 +1,6 @@
   use APR::Table;
   use APR::Error;
   
  -package Apache::Cookie::Jar;
  -push our(@ISA), __PACKAGE__ -> env;
  -
   package Apache::Cookie::Table;
   push our(@ISA), "APR::Table";
   BEGIN {
  @@ -18,16 +15,25 @@
   package Apache::Cookie::Error;
   push our(@ISA), qw/APR::Error Apache::Cookie/;
   
  -package Apache::Cookie::Jar::Error;
  -push our(@ISA), qw/APR::Error Apache::Cookie::Jar/;
  +package Apache::Cookie::Jar;
  +
  +sub new {
  +    my $class = shift;
  +    my $env = shift;
  +    my $jar = $class->jar($env);
  +    $jar->config(@_) if @_;
  +    return $jar;
  +}
  +
   
   package Apache::Cookie;
   
   sub jar {
  -    my $self = shift;
  -    return Apache::Cookie::Jar->new(@_);
  +    my ($self, $env) = @_;
  +    Apache::Cookie::Jar->jar($env);
   }
   
  +
   sub new {
       my ($class, $env, %attrs) = @_;
       my $name  = delete $attrs{name};
  @@ -64,11 +70,15 @@
   sub freeze {
       my ($class, $value) = @_;
       return encode($value) if not ref $value;
  -    return $value->freeze if UNIVERSAL::can($value,"freeze");
  -    if (UNIVERSAL::isa($value,"ARRAY")) {
  +    if (my $freeze = UNIVERSAL::can($value, "freeze")) {
  +        my $val = $freeze->($value);
  +        return $val if $val =~ /^".+"$/ or $val !~ tr/\r\n\t ;,//;
  +        die "Unsafe encoding of cookie value $value: $val";
  +    }
  +    if (UNIVERSAL::isa($value, "ARRAY")) {
           return join '&', map encode($_), @$value;
       }
  -    elsif (UNIVERSAL::isa($value,"HASH")) {
  +    elsif (UNIVERSAL::isa($value, "HASH")) {
           return join '&', map encode($_), %$value;
       }
       else {
  
  
  
  1.48      +23 -2     httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h
  
  Index: Apache__Request.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Apache__Request.h	18 Jul 2004 23:24:51 -0000	1.47
  +++ Apache__Request.h	22 Jul 2004 03:29:09 -0000	1.48
  @@ -96,7 +96,28 @@
                   newSVpvn((ptr)->v.data,(ptr)->v.size)
   
   APREQ_XS_DEFINE_ENV(request);
  -APREQ_XS_DEFINE_OBJECT(request);
  +
  +static XS(apreq_xs_request)
  +{
  +    dXSARGS;
  +    void *env;
  +    const char *data;
  +    apreq_request_t *req;
  +
  +    if (items < 2 || SvROK(ST(0)) || !SvROK(ST(1)))
  +        Perl_croak(aTHX_ "Usage: $class->request($env, $data)");
  +
  +    env = (void *)SvIVX(SvRV(ST(1)));
  +    data = (items == 3)  ?  SvPV_nolen(ST(2)) :  NULL;
  +    req = apreq_request(env, data);
  +
  +    /*FIXME: mg_mg->ptr */
  +    ST(0) = sv_2mortal(apreq_xs_2sv(req, SvPV_nolen(ST(0)),ST(1)));
  +    XSRETURN(1);
  +}
  +
  +
  +
   
   /* Too many GET macros :-( */
   
  @@ -143,7 +164,7 @@
   APREQ_XS_DEFINE_POOL(request);
   APREQ_XS_DEFINE_POOL(table);
   
  -APREQ_XS_DEFINE_TABLE_MAKE(request);
  +APREQ_XS_DEFINE_TABLE_MAKE(request, NULL);
   APREQ_XS_DEFINE_TABLE_METHOD_N(param,set);
   APREQ_XS_DEFINE_TABLE_METHOD_N(param,add);
   
  
  
  
  1.19      +4 -4      httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pm
  
  Index: Request_pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pm,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Request_pm	8 Jul 2004 19:55:57 -0000	1.18
  +++ Request_pm	22 Jul 2004 03:29:09 -0000	1.19
  @@ -17,7 +17,7 @@
   push our(@ISA), qw/APR::Error Apache::Request/;
   
   package Apache::Request;
  -push our(@ISA), __PACKAGE__ -> env;
  +push our(@ISA), "Apache::RequestRec" if  __PACKAGE__ -> env eq "Apache::RequestRec";
   
   sub new {
       my $class = shift;
  @@ -35,7 +35,7 @@
   *params = *param;
   
   sub param_status {
  -   my $req = shift;
  -   return wantarray ? ($req->args_status, $req->body_status)
  -                    : $req->args_status || $req->body_status;
  +    my $req = shift;
  +    return wantarray ? ($req->args_status, $req->body_status)
  +                     : $req->args_status || $req->body_status;
   }
  
  
  
  1.27      +1 -1      httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h
  
  Index: Apache__Upload.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Apache__Upload.h	18 Jul 2004 23:24:51 -0000	1.26
  +++ Apache__Upload.h	22 Jul 2004 03:29:09 -0000	1.27
  @@ -111,7 +111,7 @@
   
   APREQ_XS_DEFINE_POOL(upload_table);
   
  -APREQ_XS_DEFINE_TABLE_MAKE(request);
  +APREQ_XS_DEFINE_TABLE_MAKE(request, UPLOAD_PKG);
   APREQ_XS_DEFINE_TABLE_METHOD_N(param,add);
   APREQ_XS_DEFINE_TABLE_METHOD_N(param,set);
   APREQ_XS_DEFINE_TABLE_NEXTKEY(upload_table);
  
  
  
  1.34      +2 -1      httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map
  
  Index: apreq_functions.map
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- apreq_functions.map	20 Jul 2004 16:20:44 -0000	1.33
  +++ apreq_functions.map	22 Jul 2004 03:29:09 -0000	1.34
  @@ -76,11 +76,12 @@
    apr_status_t:DEFINE_bake2| apreq_cookie_bake2(apreq_xs_sv2cookie(c), apreq_xs_sv2env(SvRV(c)))
| SV *:c
   
   MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Jar PREFIX=Apache__Cookie__Jar_
  - DEFINE_new        | apreq_xs_jar     |
  + DEFINE_jar        | apreq_xs_jar     |
    DEFINE_env        | apreq_xs_jar_env |
    DEFINE_cookies    | apreq_xs_jar_get |
    DEFINE_get        | apreq_xs_jar_get |
    DEFINE_pool       | apreq_xs_jar_pool |
  + DEFINE_config     | apreq_xs_jar_config |
   
   MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Table PREFIX=Apache__Cookie__Table_
    DEFINE_get        | apreq_xs_table_get |
  
  
  

Mime
View raw message