You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2002/02/18 17:48:27 UTC

cvs commit: httpd-apreq/c apache_multipart_buffer.c apache_request.c

joes        02/02/18 08:48:27

  Modified:    c        apache_multipart_buffer.c apache_request.c
  Log:
  Mozilla 0.97 hack- final attempt?
  
  Mozilla 0.97 is missing a required CRLF with each empty file field.
  This problem also affects the (correctly) precomputed Content-Length
  header, so we must adjust r->remaining to prevent a blocked ap_bread
  inside ap_get_client_block.  This means we must also curb fill_buffer's
  appetite by preventing it from reading the entire final boundary marker.
  This should provide enough room to correct r->remaining and prevent
  the ap_bread block.
  
  Revision  Changes    Path
  1.10      +7 -0      httpd-apreq/c/apache_multipart_buffer.c
  
  Index: apache_multipart_buffer.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/c/apache_multipart_buffer.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apache_multipart_buffer.c	31 Jan 2002 06:35:12 -0000	1.9
  +++ apache_multipart_buffer.c	18 Feb 2002 16:48:27 -0000	1.10
  @@ -105,6 +105,13 @@
       /* calculate the free space in the buffer */
       bytes_to_read = self->bufsize - self->bytes_in_buffer;
   
  +    if (bytes_to_read >= self->r->remaining) {
  +        bytes_to_read = self->r->remaining - strlen(self->boundary);
  +#ifdef DEBUG
  +        ap_log_rerror(MPB_ERROR, "mozilla 0.97 hack: '%ld'", self->r->remaining);
  +#endif
  +    }
  +
       /* read the required number of bytes */
       if(bytes_to_read > 0) {
   	char *buf = self->buffer + self->bytes_in_buffer;
  
  
  
  1.20      +8 -0      httpd-apreq/c/apache_request.c
  
  Index: apache_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/c/apache_request.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- apache_request.c	12 Feb 2002 17:03:10 -0000	1.19
  +++ apache_request.c	18 Feb 2002 16:48:27 -0000	1.20
  @@ -415,6 +415,14 @@
   	int blen, wlen;
   
   	if (!header) {
  +#ifdef DEBUG
  +            ap_log_rerror(REQ_ERROR,
  +		      "[libapreq] silently drop remaining '%ld' bytes", r->remaining);
  +#endif
  +            ap_hard_timeout("[libapreq] parse_multipart", r);
  +            while ( ap_get_client_block(r, buff, sizeof(buff)) > 0 )
  +                /* wait for more input to ignore */ ;
  +            ap_kill_timeout(r);
   	    return OK;
   	}