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/src apreq_params.c apreq_params.h apreq_parsers.h
Date Sun, 29 Jun 2003 03:41:17 GMT
joes        2003/06/28 20:41:17

  Modified:    build    xsbuilder.pl
               glue/perl/xsbuilder/Apache/Cookie Apache__Cookie.h
               glue/perl/xsbuilder/Apache/Request Apache__Request.h
                        Request_pm
               glue/perl/xsbuilder/maps apreq_functions.map
               src      apreq_params.c apreq_params.h apreq_parsers.h
  Log:
  s/read_bytes/read_ahead/ in apreq_cfg_t,added apreq_request_config & XS wrapper.  Modified
xsbuilder.pl to allow it to parse the header files in glue/perl/xsbuilder (mainly hoping this
will eventually generate better pdd/pod)
  
  Revision  Changes    Path
  1.7       +10 -6     httpd-apreq-2/build/xsbuilder.pl
  
  Index: xsbuilder.pl
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/build/xsbuilder.pl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- xsbuilder.pl	12 Jun 2003 05:55:32 -0000	1.6
  +++ xsbuilder.pl	29 Jun 2003 03:41:17 -0000	1.7
  @@ -48,7 +48,10 @@
   my $mp2_typemaps = Apache::Build->new->typemaps;
   read DATA, my $grammar, -s DATA;
   
  -my %c_macro_cache;
  +my %c_macro_cache = (
  +                     XS => sub {s/XS\s*\(([^)]+)\)/void $1()/g},
  +
  +);
   sub c_macro
   {
       return $c_macro_cache{"@_"} if exists $c_macro_cache{"@_"};
  @@ -77,11 +80,12 @@
   
   
   package My::ParseSource;
  +my @dirs = ("$base_dir/src", "$base_dir/glue/perl/xsbuilder");
   use base qw/ExtUtils::XSBuilder::ParseSource/;
   __PACKAGE__->$_ for shift || ();
   
  -sub package {'Apache::Request'}
  -
  +sub package {'Apache::libapreq'}
  +sub unwanted_includes {["apreq_tables.h"]}
   # ParseSource.pm v 0.23 bug: line 214 should read
   # my @dirs = @{$self->include_dirs};
   # for now, we override it here just to work around the bug
  @@ -112,8 +116,7 @@
       return $self->{includes} = $self -> sort_includes (\@includes) ;
   }
   
  -
  -sub include_dirs {["$base_dir/src",]}# "$base_dir/glue/perl/xsinclude"]}
  +sub include_dirs {\@dirs}
   
   sub preprocess
   {
  @@ -126,6 +129,7 @@
           ::c_macro("APREQ_DECLARE_PARSER", "apreq_parsers.h")->();
           ::c_macro("APREQ_DECLARE_LOG", "apreq_env.h")->();
           ::c_macro("APR_DECLARE")->();
  +        ::c_macro("XS")-> ();
       }
   }
   
  @@ -155,7 +159,7 @@
   
   
   package My::WrapXS;
  -
  +pop @dirs; # drop mod_h directories- WrapXS takes care of those
   use base qw/ExtUtils::XSBuilder::WrapXS/;
   our $VERSION = '0.1';
   __PACKAGE__ -> $_ for @ARGV;
  
  
  
  1.11      +14 -1     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Apache__Cookie.h	28 Jun 2003 17:51:38 -0000	1.10
  +++ Apache__Cookie.h	29 Jun 2003 03:41:17 -0000	1.11
  @@ -58,6 +58,10 @@
   #define apreq_xs_cookie2sv(c,class) apreq_xs_2sv(c,class)
   #define apreq_xs_sv2cookie(sv) ((apreq_cookie_t *)SvIVX(SvRV(sv)))
   
  +/** 
  + * env 
  + * @param The CooKIE
  + */
   APREQ_XS_DEFINE_ENV(cookie);
   APREQ_XS_DEFINE_ENV(jar);
   APREQ_XS_DEFINE_MAKE(cookie);
  @@ -83,7 +87,10 @@
   APREQ_XS_DEFINE_GET(jar,   TABLE_PKG, cookie, COOKIE_PKG, 1);
   APREQ_XS_DEFINE_GET(table, TABLE_PKG, cookie, COOKIE_PKG, 1);
   
  -
  +/**
  + *Returns serialized version of cookie.
  + *@param $cookie cookie
  + */
   static XS(apreq_xs_cookie_as_string)
   {
       dXSARGS;
  @@ -101,6 +108,12 @@
       ST(0) = sv_2mortal(sv);
       XSRETURN(1);
   }
  +
  +/**
  + * Cookie exipiration time.  Depends on cookie version.
  + * @param cookie
  + * @return expiration date.
  + */
   
   static XS(apreq_xs_cookie_expires)
   {
  
  
  
  1.13      +24 -0     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Apache__Request.h	27 Jun 2003 18:23:18 -0000	1.12
  +++ Apache__Request.h	29 Jun 2003 03:41:17 -0000	1.13
  @@ -180,3 +180,27 @@
       XSRETURN_UNDEF;
   }
   
  +
  +static XS(apreq_xs_request_config)
  +{
  +    dXSARGS;
  +    apreq_request_t *req;
  +    apr_status_t status = APR_SUCCESS;
  +    int j = 1;
  +    if (items == 0)
  +        XSRETURN_UNDEF;
  +    if (!SvROK(ST(0)))
  +        Perl_croak(aTHX_ "usage: $req->config(@settings)");
  +
  +    req = apreq_xs_sv2(request,ST(0));
  +
  +    for (j = 1; j + 1 < items; j += 2) {
  +        STRLEN alen, vlen;
  +        const char *attr = SvPV(ST(j),alen), *val = SvPV(ST(j+1),vlen);
  +        status = apreq_request_config(req, attr, alen, val, vlen); 
  +        if (status != APR_SUCCESS)
  +            break;
  +    }
  +    XSRETURN_IV(status);
  +}
  +
  
  
  
  1.7       +0 -1      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Request_pm	24 Jun 2003 22:27:44 -0000	1.6
  +++ Request_pm	29 Jun 2003 03:41:17 -0000	1.7
  @@ -13,7 +13,6 @@
   package Apache::Request;
   push our(@ISA), __PACKAGE__ -> env;
   
  -sub config {}
   sub new {
       my $class = shift;
       my $env = shift;
  
  
  
  1.11      +1 -0      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- apreq_functions.map	27 Jun 2003 16:21:03 -0000	1.10
  +++ apreq_functions.map	29 Jun 2003 03:41:17 -0000	1.11
  @@ -11,6 +11,7 @@
    DEFINE_args    | apreq_xs_args_get |
    DEFINE_body    | apreq_xs_body_get |
    DEFINE_upload  | apreq_xs_upload_get |
  + DEFINE_config  | apreq_xs_request_config |
   
   MODULE=Apache::Request PACKAGE=Apache::Request::Table PREFIX=Apache__Request__Table_
    DEFINE_get     | apreq_xs_table_get |
  
  
  
  1.28      +63 -3     httpd-apreq-2/src/apreq_params.c
  
  Index: apreq_params.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_params.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- apreq_params.c	28 Jun 2003 17:51:38 -0000	1.27
  +++ apreq_params.c	29 Jun 2003 03:41:17 -0000	1.28
  @@ -60,7 +60,7 @@
   #include "apreq_parsers.h"
   #include "apreq_env.h"
   #include "apr_strings.h"
  -
  +#include "apr_lib.h"
   
   /** default parser configuration */
   
  @@ -182,8 +182,8 @@
       if (val == NULL) {
           apreq_cfg_t *cfg = req->cfg;
   
  -        if (cfg && cfg->read_bytes) {
  -            apreq_env_read(req->env, APR_NONBLOCK_READ, cfg->read_bytes);
  +        if (cfg && cfg->read_ahead) {
  +            apreq_env_read(req->env, APR_NONBLOCK_READ, cfg->read_ahead);
               val = apr_table_get(req->body, name);
           }
       }
  @@ -365,4 +365,64 @@
           return NULL;
       apr_table_do(upload_get, &param, req->body, key, NULL);
       return param;
  +}
  +
  +APREQ_DECLARE(apr_status_t) 
  +    apreq_request_config(apreq_request_t *req, 
  +                         const char *attr, apr_size_t alen,
  +                         const char *val, apr_size_t vlen)
  +{
  +    apreq_cfg_t *cfg = req->cfg;
  +    apr_pool_t *p;
  +
  +    if (alen < 2)
  +        return APR_BADARG;
  +
  +    if ( attr[0] ==  '-' || attr[0] == '$' ) {
  +        ++attr;
  +        --alen;
  +    }
  +
  +    switch (apr_tolower(*attr)) {
  +
  +    case 'p': /* POST_MAX */
  +        cfg->max_len = apreq_atoi64f(val);
  +        break;
  +
  +    case 'd': /* DISABLE_UPLOADS */
  +        while (!apr_isdigit(*val)) {
  +            if (vlen == 0)
  +                return APR_BADARG;
  +            ++val;
  +            --vlen;
  +        }
  +        cfg->disable_uploads = *val - '0';
  +        break;
  +
  +    case 'f': /* FIELD_LIMIT */
  +        cfg->max_fields = apreq_atoi64f(val);
  +        break;
  +
  +    case 'b': /* BRIGADE_LIMIT */
  +        cfg->max_brigade_len = apreq_atoi64f(val);
  +        break;
  +
  +    case 'r': /* READ_AHEAD */
  +        cfg->read_ahead = apreq_atoi64f(val);
  +        break;
  +
  +    case 't': /* TEMP_DIR */
  +        p = apreq_env_pool(req->env);
  +        cfg->temp_dir = (vlen ? apr_pstrmemdup(p,val,vlen) : NULL);
  +        break;
  +
  +    case 'u': /* UPLOAD_HOOK */
  +        /* XXX not implemented yet */
  +
  +    default:
  +        return APR_ENOTIMPL;
  +
  +    };
  +
  +    return APR_SUCCESS;
   }
  
  
  
  1.23      +4 -0      httpd-apreq-2/src/apreq_params.h
  
  Index: apreq_params.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_params.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- apreq_params.h	28 Jun 2003 17:51:38 -0000	1.22
  +++ apreq_params.h	29 Jun 2003 03:41:17 -0000	1.23
  @@ -243,6 +243,10 @@
   APREQ_DECLARE(apreq_param_t *) apreq_upload(const apreq_request_t *req,
                                               const char *key);
   
  +APREQ_DECLARE(apr_status_t) 
  +    apreq_request_config(apreq_request_t *req, 
  +                         const char *attr, apr_size_t alen,
  +                         const char *val, apr_size_t vlen);
   
   /** @} */
   #ifdef __cplusplus
  
  
  
  1.19      +1 -1      httpd-apreq-2/src/apreq_parsers.h
  
  Index: apreq_parsers.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_parsers.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- apreq_parsers.h	27 Jun 2003 18:23:18 -0000	1.18
  +++ apreq_parsers.h	29 Jun 2003 03:41:17 -0000	1.19
  @@ -82,7 +82,7 @@
       apr_off_t      max_len;
       apr_size_t     max_brigade_len; /* in-memory cutoff */
       int            max_fields;
  -    int            read_bytes; /* prefetch length */
  +    int            read_ahead; /* prefetch length */
       int            disable_uploads;
       char          *temp_dir;
   } apreq_cfg_t;
  
  
  

Mime
View raw message