You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/06/21 01:59:37 UTC

cvs commit: modperl-2.0/xs/Apache/RequestIO Apache__RequestIO.h

dougm       01/06/20 16:59:37

  Modified:    xs/Apache/RequestIO Apache__RequestIO.h
  Log:
  fix $r->read not to mess with r->read_length
  fix $r->read and $r->get_client_block to set the buffer to "" rather
  than undef, like CORE::read() does
  these changes fix the modules/cgiupload test
  
  Revision  Changes    Path
  1.12      +6 -9      modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Apache__RequestIO.h	2001/05/07 01:31:26	1.11
  +++ Apache__RequestIO.h	2001/06/20 23:59:37	1.12
  @@ -95,7 +95,7 @@
           SvTAINTED_on(buffer);
       }
       else {
  -        sv_setsv(buffer, &PL_sv_undef); /* XXX */
  +        sv_setpvn(buffer, "", 0);
       }
   
       return nrd;
  @@ -109,10 +109,11 @@
                                            int offset)
   {
       dTHX; /*XXX*/
  -    long nrd = 0, old_read_length;
  +    long nrd = 0;
       int rc;
   
       if (!r->read_length) {
  +        /* only do this once per-request */
           if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) {
               ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0,
                            r->server,
  @@ -121,22 +122,18 @@
           }
       }
   
  -    old_read_length = r->read_length;
  -    r->read_length = 0;
  -
  -    if (ap_should_client_block(r)) {
  +    if (r->read_length || ap_should_client_block(r)) {
  +        /* ap_should_client_block() will return 0 if r->read_length */
           mpxs_sv_grow(buffer, bufsiz+offset);
           nrd = ap_get_client_block(r, SvPVX(buffer)+offset, bufsiz);
       }
   
  -    r->read_length += old_read_length;
  -
       if (nrd > 0) {
           mpxs_sv_cur_set(buffer, nrd+offset);
           SvTAINTED_on(buffer);
       } 
       else {
  -        sv_setsv(buffer, &PL_sv_undef);
  +        sv_setpvn(buffer, "", 0);
       }
   
       return nrd;