httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server protocol.c
Date Thu, 16 Aug 2001 05:04:39 GMT
rbb         01/08/15 22:04:39

  Modified:    .        CHANGES STATUS
               server   protocol.c
  Log:
  Fix ap_rvprintf to support more than 4K of data.
  Submitted by:	Cody Sherr <csherr@covalent.net>
  
  Revision  Changes    Path
  1.295     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.294
  retrieving revision 1.295
  diff -u -r1.294 -r1.295
  --- CHANGES	2001/08/16 01:50:45	1.294
  +++ CHANGES	2001/08/16 05:04:38	1.295
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.24-dev
   
  +  *) Fix ap_rvprintf to support more than 4K of data at one time.
  +     [Cody Sherr <csherr@covalent.net>]
  +
     *) We have always used the obsolete/deprecated Netscape syntax
        for our tracking cookies; now the CookieStyle directive
        allows the Webmaster to choose the Netscape, RFC2109, or
  
  
  
  1.270     +1 -4      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.269
  retrieving revision 1.270
  diff -u -r1.269 -r1.270
  --- STATUS	2001/08/16 05:01:43	1.269
  +++ STATUS	2001/08/16 05:04:38	1.270
  @@ -1,5 +1,5 @@
   APACHE 2.0 STATUS:						-*-text-*-
  -Last modified at [$Date: 2001/08/16 05:01:43 $]
  +Last modified at [$Date: 2001/08/16 05:04:38 $]
   
   Release:
   
  @@ -57,9 +57,6 @@
   	    disable-shared was because the shared lib wasn't getting
   	    installed and a "make clean" in aprutil would make Apache
   	    fail to load.
  -
  -    * ap_vrprintf() needs to handle more than 4K
  -        Status: Greg volunteers
   
       * mod_dir should normally redirect ALL directory requests which do
         not include a trailing slash on the URI. However, if a "notes"
  
  
  
  1.39      +49 -5     httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- protocol.c	2001/08/07 16:40:25	1.38
  +++ protocol.c	2001/08/16 05:04:39	1.39
  @@ -1133,19 +1133,63 @@
       return nbyte;
   }
   
  +struct ap_vrprintf_data {
  +    apr_vformatter_buff_t vbuff;
  +    request_rec *r;
  +    char *buff;
  +};
  +
  +static apr_status_t r_flush(apr_vformatter_buff_t *buff)
  +{
  +    /* callback function passed to ap_vformatter to be called when
  +     * vformatter needs to write into buff and buff.curpos > buff.endpos */
  +
  +    /* ap_vrprintf_data passed as a apr_vformatter_buff_t, which is then
  +     * "downcast" to an ap_vrprintf_data */
  +    struct ap_vrprintf_data *vd = (struct ap_vrprintf_data*)buff;
  +
  +    if (vd->r->connection->aborted)
  +        return -1;
  +
  +    /* r_flush is called when vbuff is completely full */
  +    if (buffer_output(vd->r, vd->buff, AP_IOBUFSIZE)) {
  +	return -1;
  +    }
  +
  +    /* reset the buffer position */
  +    vd->vbuff.curpos = vd->buff;
  +    vd->vbuff.endpos = vd->buff + AP_IOBUFSIZE;
  +
  +    return APR_SUCCESS;
  +}
  +
   AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
   {
  -    char buf[4096];
       apr_size_t written;
  +    struct ap_vrprintf_data vd;
  +    static char vrprintf_buf[AP_IOBUFSIZE];
  +
  +    vd.vbuff.curpos = vrprintf_buf;
  +    vd.vbuff.endpos = vrprintf_buf + AP_IOBUFSIZE;
  +    vd.r = r;
  +    vd.buff = vrprintf_buf;
   
       if (r->connection->aborted)
           return -1;
   
  -    /* ### fix this mechanism to allow more than 4K of output */
  -    written = apr_vsnprintf(buf, sizeof(buf), fmt, va);
  +    written = apr_vformatter(r_flush, &vd.vbuff, fmt, va);
  +    /* tack on null terminator on remaining string */
  +    *(vd.vbuff.curpos) = '\0';
   
  -    if (buffer_output(r, buf, written) != APR_SUCCESS)
  -        return -1;
  +    if (written != -1) {
  +	int n = vd.vbuff.curpos - vrprintf_buf;
  +
  +	/* last call to buffer_output, to finish clearing the buffer */
  +	if (buffer_output(r, vrprintf_buf,n) != APR_SUCCESS)
  +	    return -1;
  +
  +	written += n;
  +    }
   
       return written;
   }
  
  
  

Mime
View raw message