You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/01/27 07:25:05 UTC

cvs commit: apache/src buff.c

dgaudet     98/01/26 22:25:05

  Modified:    src      Tag: APACHE_1_2_X buff.c
  Log:
  This is the proper fix for chunked encoding and bputc()... the last one
  misses cases where bputc() is mixed with other bwrite() calls.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.26.2.3  +12 -9     apache/src/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/buff.c,v
  retrieving revision 1.26.2.2
  retrieving revision 1.26.2.3
  diff -u -r1.26.2.2 -r1.26.2.3
  --- buff.c	1998/01/14 00:02:56	1.26.2.2
  +++ buff.c	1998/01/27 06:25:02	1.26.2.3
  @@ -187,7 +187,13 @@
   }
   
   /*
  - * start chunked encoding
  + * Start chunked encoding.
  + *
  + * Note that in order for bputc() to be an efficient macro we have to
  + * guarantee that start_chunk() has always been called on the buffer before we
  + * leave any routine in this file.  Said another way, if a routine here uses
  + * end_chunk() and writes something on the wire, then it has to call
  + * start_chunk() or set an error condition before returning.
    */
   static void
   start_chunk( BUFF *fb )
  @@ -584,16 +590,9 @@
   bflsbuf(int c, BUFF *fb)
   {
       char ss[1];
  -    int rc;
   
       ss[0] = c;
  -    rc = bwrite(fb, ss, 1);
  -    /* We do start_chunk() here so that the bputc macro can be smaller
  -     * and faster
  -     */
  -    if (rc == 1 && (fb->flags & B_CHUNK))
  -	start_chunk(fb);
  -    return rc;
  +    return bwrite(fb, ss, 1);
   }
   
   /*
  @@ -913,6 +912,10 @@
   	if (fb->flags & B_EOUT)
   	    return -1;
       }
  +
  +    if (fb->flags & B_CHUNK)
  +	start_chunk(fb);
  +
       return 0;
   }