perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/xs/Apache/Filter Apache__Filter.h
Date Wed, 15 Jan 2003 06:11:09 GMT
stas        2003/01/14 22:11:09

  Modified:    xs/Apache/Filter Apache__Filter.h
  Log:
  input filters are now supported
  
  Revision  Changes    Path
  1.22      +21 -8     modperl-2.0/xs/Apache/Filter/Apache__Filter.h
  
  Index: Apache__Filter.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Apache__Filter.h	12 Jan 2003 02:33:27 -0000	1.21
  +++ Apache__Filter.h	15 Jan 2003 06:11:08 -0000	1.22
  @@ -26,7 +26,7 @@
           mpxs_write_loop(modperl_output_filter_write, modperl_filter);
       }
       else {
  -        Perl_croak(aTHX_ "input filters not yet supported");
  +        mpxs_write_loop(modperl_input_filter_write, modperl_filter);
       }
   
       /* XXX: ap_rflush if $| */
  @@ -38,23 +38,36 @@
                                                        SV **MARK, SV **SP)
   {
       modperl_filter_t *modperl_filter;
  +    ap_input_mode_t mode = 0;
  +    apr_read_type_e block = 0;
  +    apr_off_t readbytes = 0;
       apr_size_t wanted, len=0;
       SV *buffer;
  -
  -    mpxs_usage_va_2(modperl_filter, buffer, "$filter->read(buf, [len])");
  -
  -    if (items > 2) {
  +    
  +    if (items < 4) {
  +        mpxs_usage_va_2(modperl_filter, buffer, "$filter->read(buf, [len])");
  +    }
  +    else {
  +        modperl_filter = mp_xs_sv2_modperl_filter(*MARK); MARK++;
  +        mode           = (ap_input_mode_t)SvIV(*MARK); MARK++;
  +        block          = (apr_read_type_e)SvIV(*MARK); MARK++;
  +        readbytes      = (apr_off_t)SvIV(*MARK); MARK++;
  +        buffer         = *MARK++;
  +    }
  +        
  +    if (items == 3 || items == 6) {
           wanted = SvIV(*MARK);
       }
       else {
           wanted = MP_IOBUFSIZE;
       }
   
  -    if (modperl_filter->mode == MP_OUTPUT_FILTER_MODE) {
  -        len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted);
  +    if (modperl_filter->mode == MP_INPUT_FILTER_MODE) {
  +        len = modperl_input_filter_read(aTHX_ modperl_filter, mode,
  +                                        block, readbytes, buffer, wanted);
       }
       else {
  -        Perl_croak(aTHX_ "input filters not yet supported");
  +        len = modperl_output_filter_read(aTHX_ modperl_filter, buffer, wanted);
       }
   
       return len;
  
  
  

Mime
View raw message