geoff       2002/12/06 08:19:37

  Modified:    src/modules/perl modperl_util.c modperl_util.h
               t/response/TestAPI rutil.pm
               todo     api.txt
               xs/Apache/RequestUtil Apache__RequestUtil.h
               xs/maps  modperl_functions.map
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  added $r->as_string
  Submitted by: geoff
  Reviewed by:  stas
  
  Revision  Changes    Path
  1.49      +8 -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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- modperl_util.c    1 Jul 2002 05:15:28 -0000       1.48
  +++ modperl_util.c    6 Dec 2002 16:19:36 -0000       1.49
  @@ -614,3 +614,11 @@
                       GvNAME(gv), GvNAMELEN(gv), G_DISCARD);
       return rv;
   }
  +
  +int modperl_sv_str_header(void *arg, const char *k, const char *v)
  +{
  +    SV *sv = (SV*)arg;
  +    sv_catpvf(sv, "%s: %s\n", k, v);
  +    return 1;
  +}
  +
  
  
  
  1.36      +2 -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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- modperl_util.h    21 Jun 2002 00:44:24 -0000      1.35
  +++ modperl_util.h    6 Dec 2002 16:19:36 -0000       1.36
  @@ -119,4 +119,6 @@
   
   SV *modperl_perl_gensym(pTHX_ char *pack);
       
  +int modperl_sv_str_header(void *arg, const char *k, const char *v);
  +
   #endif /* MODPERL_UTIL_H */
  
  
  
  1.4       +6 -1      modperl-2.0/t/response/TestAPI/rutil.pm
  
  Index: rutil.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/rutil.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rutil.pm  11 Apr 2002 11:08:43 -0000      1.3
  +++ rutil.pm  6 Dec 2002 16:19:36 -0000       1.4
  @@ -30,7 +30,7 @@
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 17;
  +    plan $r, tests => 18;
   
       ok $r->default_type;
   
  @@ -53,6 +53,11 @@
       }
   
       ok $r->is_initial_req;
  +
  +    # test for the request_line, status_ling, and few 
  +    # headers that should always be there
  +    ok $r->as_string =~ 
  +        m!GET /TestAPI::rutil.*Host:.*200 OK.*Content-Type:!s;
   
       Apache::OK;
   }
  
  
  
  1.29      +0 -3      modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- api.txt   22 Oct 2002 15:13:22 -0000      1.28
  +++ api.txt   6 Dec 2002 16:19:36 -0000       1.29
  @@ -53,9 +53,6 @@
   with fd's which aren't files and of unknown length, therefore it cannot 
   be used for implementing 1.x compatible send_fd.
   
  -$r->as_string:
  -not yet implemented
  -
   Apache::{Server,Process} classes:
   require mutex lock for writing
   
  
  
  
  1.13      +23 -0     modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Apache__RequestUtil.h     5 Dec 2001 19:00:29 -0000       1.12
  +++ Apache__RequestUtil.h     6 Dec 2002 16:19:36 -0000       1.13
  @@ -214,3 +214,26 @@
   
       return dcfg->location;
   }
  +
  +static MP_INLINE
  +SV *mpxs_Apache__RequestRec_as_string(pTHX_ request_rec *r)
  +{
  +    SV *retval = newSVpv(r->the_request, 0);
  +
  +    sv_catpvn(retval, "\n", 1);
  +
  +    apr_table_do((int (*) (void *, const char *, const char *))
  +                  modperl_sv_str_header, (void *) retval, r->headers_in, NULL);
  +
  +    sv_catpvf(retval, "\n%s %s\n", r->protocol, r->status_line);
  +
  +    apr_table_do((int (*) (void *, const char *, const char *))
  +                  modperl_sv_str_header, (void *) retval, r->headers_out, NULL);
  +    apr_table_do((int (*) (void *, const char *, const char *))
  +                  modperl_sv_str_header, (void *) retval, r->err_headers_out, NULL);
  +
  +    sv_catpvn(retval, "\n", 1);
  +
  +    return retval;
  +}
  +
  
  
  
  1.46      +1 -0      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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- modperl_functions.map     5 Sep 2002 01:48:40 -0000       1.45
  +++ modperl_functions.map     6 Dec 2002 16:19:36 -0000       1.46
  @@ -18,6 +18,7 @@
    mpxs_Apache__RequestRec_set_handlers
    mpxs_Apache__RequestRec_get_handlers
    mpxs_Apache__RequestRec_location
  + mpxs_Apache__RequestRec_as_string
    mpxs_Apache__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
    modperl_config_insert_request | | \
     r, lines, path=r->filename, override=OR_AUTHCFG | add_config
  
  
  
  1.87      +15 -1     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.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- FunctionTable.pm  21 Oct 2002 17:58:40 -0000      1.86
  +++ FunctionTable.pm  6 Dec 2002 16:19:36 -0000       1.87
  @@ -6242,7 +6242,21 @@
           'name' => 'func'
         }
       ]
  -  }
  +  },
  +  {
  +    'return_type' => 'SV *',
  +    'name' => 'mpxs_Apache__RequestRec_as_string',
  +    'args' => [
  +      {
  +        'type' => 'PerlInterpreter *',
  +        'name' => 'my_perl'
  +      },
  +      {
  +        'type' => 'request_rec *',
  +        'name' => 'r'
  +      }
  +    ]
  +  },
   ];
   
   
  
  
  


Reply via email to