You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/06/02 19:23:36 UTC

cvs commit: apache-2.0/src/main buff.c

trawick     00/06/02 10:23:36

  Modified:    src/main buff.c
  Log:
  APACHE_XLATE flavor of ap_bwrite_xlate():
  
    don't check for B_WRERR and B_EOUT; ap_bwrite_core() will
    take care of that
  
    in arg list to ap_xlate_conv_buffer(), don't check for
    whether or not we have fb->xbuf; we die earlier if we don't
    (the fallback use of buf, from 1.3, is bogus anyway)
  
    don't blow up if ap_xlate_conv_buffer() returns a bad
    return code; if admin is confused about the charset in which
    the docs are stored, xlate can fail
  
  Revision  Changes    Path
  1.45      +10 -9     apache-2.0/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/buff.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- buff.c	2000/05/30 02:45:15	1.44
  +++ buff.c	2000/06/02 17:23:36	1.45
  @@ -941,15 +941,11 @@
   
   #ifdef APACHE_XLATE
   static ap_status_t ap_bwrite_xlate(BUFF *fb, const void *buf, ap_size_t nbyte,
  -                                  ap_ssize_t *bytes_written)
  +                                   ap_ssize_t *bytes_written)
   {
       ap_size_t inbytes_left, outbytes_left;
       ap_status_t rv;
       
  -    if (fb->flags & (B_WRERR | B_EOUT)) {
  -        *bytes_written = 0;
  -	return fb->saved_errno;
  -    }
       if (nbyte == 0) {
           *bytes_written = 0;
   	return APR_SUCCESS;
  @@ -965,10 +961,15 @@
       }
       inbytes_left = outbytes_left = nbyte;
       rv = ap_xlate_conv_buffer(fb->write_xlate, buf, &inbytes_left,
  -                              fb->xbuf ? fb->xbuf : (void *)buf, &outbytes_left);
  -    /* we still only handle SBCS conversions */
  -    ap_assert(!rv && !inbytes_left && !outbytes_left);
  -
  +                              fb->xbuf, &outbytes_left);
  +    if (rv) {
  +        /* the content may not be in the expected charset
  +         */
  +        *bytes_written = 0;
  +        fb->saved_errno = rv;
  +        doerror(fb, B_WR);
  +        return rv;
  +    }
       return ap_bwrite_core(fb, fb->xbuf, nbyte, bytes_written);
   }
   #endif /* APACHE_XLATE */