perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
Date Sun, 22 Aug 2004 20:47:37 GMT
gozer       2004/08/22 13:47:37

  Modified:    .        Changes
               src/modules/perl modperl_util.c modperl_util.h
               t/response/TestAPI request_rec.pm
               todo     release
               xs/Apache/RequestRec Apache__RequestRec.h
               xs/maps  apache_structures.map modperl_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  Added $r->content_languages in Apache::RequestRec
  
  Revision  Changes    Path
  1.460     +2 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.459
  retrieving revision 1.460
  diff -u -r1.459 -r1.460
  --- Changes	20 Aug 2004 21:11:00 -0000	1.459
  +++ Changes	22 Aug 2004 20:47:37 -0000	1.460
  @@ -12,6 +12,8 @@
   
   =item 1.99_16-dev
   
  +Added $r->content_languages in Apache::RequestRec [Gozer]
  +
   APR::Bucket: add delete() and destroy() methods [Stas]
   
   
  
  
  
  1.76      +37 -0     modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- modperl_util.c	15 Aug 2004 20:06:51 -0000	1.75
  +++ modperl_util.c	22 Aug 2004 20:47:37 -0000	1.76
  @@ -713,3 +713,40 @@
   
       return text;
   }
  +
  +SV *modperl_apr_array_header2avrv(pTHX_ apr_array_header_t *array)
  +{
  +    AV *av = newAV(); 
  +
  +    if (array) {
  +        int i; 
  +        for (i = 0; i < array->nelts; i++) {
  +            av_push(av, newSVpv(((char **)array->elts)[i], 0));
  +        }
  +    }
  +    return newRV_noinc((SV*)av);
  +}
  +
  +apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t *p,
  +                                                  SV *avrv)
  +{
  +    AV *av;
  +    apr_array_header_t *array;
  +    int i, av_size;
  +    
  +    if (!(SvROK(avrv) && (SvTYPE(SvRV(avrv)) == SVt_PVAV))) {
  +        Perl_croak(aTHX_ "Not an array reference");
  +    }
  +    
  +    av = (AV*)SvRV(avrv);
  +    av_size = av_len(av);
  +    array = apr_array_make(p, av_size+1, sizeof(char *));
  +    
  +    for (i = 0; i <= av_size; i++) {
  +        SV *sv = *av_fetch(av, i, FALSE);
  +        char **entry = (char **)apr_array_push(array);
  +        *entry = apr_pstrdup(p, SvPV(sv, PL_na));
  +    }
  +
  +    return array;
  +}
  
  
  
  1.66      +3 -0      modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- modperl_util.h	15 Aug 2004 20:06:51 -0000	1.65
  +++ modperl_util.h	22 Aug 2004 20:47:37 -0000	1.66
  @@ -106,6 +106,9 @@
    */
   char *modperl_coderef2text(pTHX_ apr_pool_t *p, CV *cv);
   
  +SV *modperl_apr_array_header2avrv(pTHX_ apr_array_header_t *array);
  +apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t *p,
  +                                                  SV *avrv);
   #if defined(MP_TRACE) && defined(APR_HAS_THREADS)
   #define MP_TRACEf_TID   "/tid 0x%lx"
   #define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
  
  
  
  1.31      +14 -2     modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- request_rec.pm	8 Aug 2004 21:32:00 -0000	1.30
  +++ request_rec.pm	22 Aug 2004 20:47:37 -0000	1.31
  @@ -23,7 +23,7 @@
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 45;
  +    plan $r, tests => 49;
   
       #Apache->request($r); #PerlOptions +GlobalRequest takes care
       my $gr = Apache->request;
  @@ -164,7 +164,19 @@
           ok $r->allowed & (1 << Apache::M_PUT);
       }
   
  +    # content_languages
  +    {
  +        my $def = [qw(fr)];       #default value
  +        my $l   = [qw(fr us cn)]; #new value
   
  +        ok t_cmp $r->content_languages, $def, '$r->content_languages';
  +        ok t_cmp $r->content_languages($l), $def, '$r->content_languages';
  +        ok t_cmp $r->content_languages, $l, '$r->content_languages';
  +
  +        eval { $r->content_languages({}) };
  +        ok t_cmp $@, qr/Not an array reference/,
  +                '$r->content_languages(invalid)';
  +    }
       # tested in other tests
       # - input_filters:    TestAPI::in_out_filters
       # - output_filters:   TestAPI::in_out_filters
  @@ -174,7 +186,6 @@
   
       # XXX: untested
       # - request_config
  -    # - content_languages
       # - allowed_xmethods
       # - allowed_methods
   
  @@ -184,3 +195,4 @@
   1;
   __END__
   PerlOptions +GlobalRequest
  +DefaultLanguage fr
  
  
  
  1.51      +0 -2      modperl-2.0/todo/release
  
  Index: release
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/release,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- release	19 Aug 2004 00:57:32 -0000	1.50
  +++ release	22 Aug 2004 20:47:37 -0000	1.51
  @@ -14,8 +14,6 @@
   
   * APR::URI missing $uri->rpath (was in mp1)
   
  -* Apache::RequestRec's $r->content_languages is missing (was in mp1)
  -
   * check other todo/features_missing items (some of them might be
     critical for 2.0 release, since missing methods might be a problem
     for migration)
  
  
  
  1.16      +14 -0     modperl-2.0/xs/Apache/RequestRec/Apache__RequestRec.h
  
  Index: Apache__RequestRec.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestRec/Apache__RequestRec.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Apache__RequestRec.h	16 Jul 2004 01:10:46 -0000	1.15
  +++ Apache__RequestRec.h	22 Aug 2004 20:47:37 -0000	1.16
  @@ -31,6 +31,20 @@
   }
   
   static MP_INLINE
  +SV *mpxs_Apache__RequestRec_content_languages(pTHX_ request_rec *r,
  +                                              SV *languages)
  +{
  +    SV *retval = modperl_apr_array_header2avrv(aTHX_ 
  +                                               r->content_languages);
  +    if (languages) {
  +        r->content_languages = modperl_avrv2apr_array_header(aTHX_ 
  +                                                             r->pool,
  +                                                             languages);
  +    }
  +    return retval;
  +}
  +
  +static MP_INLINE
   int mpxs_Apache__RequestRec_proxyreq(pTHX_ request_rec *r, SV *val)
   {
       int retval = r->proxyreq;
  
  
  
  1.46      +1 -1      modperl-2.0/xs/maps/apache_structures.map
  
  Index: apache_structures.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- apache_structures.map	17 Aug 2004 23:40:41 -0000	1.45
  +++ apache_structures.map	22 Aug 2004 20:47:37 -0000	1.46
  @@ -46,7 +46,7 @@
   ~  content_type
   ~  handler
      content_encoding
  -   content_languages
  +~  content_languages
   >  vlist_validator
      user
      ap_auth_type
  
  
  
  1.84      +1 -1      modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- modperl_functions.map	17 Aug 2004 23:40:41 -0000	1.83
  +++ modperl_functions.map	22 Aug 2004 20:47:37 -0000	1.84
  @@ -21,7 +21,7 @@
    mpxs_Apache__RequestRec_subprocess_env | | r, key=NULL, val=Nullsv
    mpxs_Apache__RequestRec_finfo | | r, finfo=NULL
    mpxs_Apache__RequestRec_handler | | ...
  -
  + mpxs_Apache__RequestRec_content_languages | | r, languages=Nullsv
   
   MODULE=Apache::RequestUtil   PACKAGE=guess
    mpxs_Apache__RequestRec_push_handlers
  
  
  
  1.175     +50 -0     modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.174
  retrieving revision 1.175
  diff -u -r1.174 -r1.175
  --- FunctionTable.pm	20 Aug 2004 21:00:19 -0000	1.174
  +++ FunctionTable.pm	22 Aug 2004 20:47:37 -0000	1.175
  @@ -18,6 +18,20 @@
       ]
     },
     {
  +    'return_type' => 'SV *',
  +    'name' => 'modperl_apr_array_header2avrv',
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'apr_array_header_t *',
  +        'name' => 'array'
  +      }
  +    ]
  +  },
  +  {
       'return_type' => 'int',
       'name' => 'modperl_authen_handler',
       'args' => [
  @@ -38,6 +52,24 @@
       ]
     },
     {
  +    'return_type' => 'apr_array_header_t *',
  +    'name' => 'modperl_avrv2apr_array_header',
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'apr_pool_t *',
  +        'name' => 'p'
  +      },
  +      {
  +        'type' => 'SV *',
  +        'name' => 'avrv'
  +      }
  +    ]
  +  },
  +  {
       'return_type' => 'void',
       'name' => 'modperl_brigade_dump',
       'args' => [
  @@ -6265,6 +6297,24 @@
         {
           'type' => 'char *',
           'name' => 'type'
  +      }
  +    ]
  +  },
  +  {
  +    'return_type' => 'SV *',
  +    'name' => 'mpxs_Apache__RequestRec_content_languages',
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'request_rec *',
  +        'name' => 'r'
  +      },
  +      {
  +        'type' => 'SV *',
  +        'name' => 'languages'
         }
       ]
     },
  
  
  

Mime
View raw message