httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/standard mod_cgi.c
Date Tue, 10 Oct 2000 04:11:37 GMT
trawick     00/10/09 21:11:36

  Modified:    src      CHANGES
               src/modules/standard mod_cgi.c
  Log:
  Write all of the request body to the child, not just what the kernel
  would accept on the first write.
  
  Because the pipe is non-blocking (via setting an APR timeout), we
  have to send in a loop.
  
  Revision  Changes    Path
  1.267     +3 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.266
  retrieving revision 1.267
  diff -u -r1.266 -r1.267
  --- CHANGES	2000/10/10 03:35:10	1.266
  +++ CHANGES	2000/10/10 04:11:35	1.267
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0a8
   
  +  *) mod_cgi: Write all of the request body to the child, not just what
  +     the kernel would accept on the first write.  [Jeff Trawick]
  +
     *) Back out the change that moved the brigade from the core_output_filters
        ctx to the conn_rec.  Since all requests over a given connection
        go through the same core_output_filter, the ctx pointer has the
  
  
  
  1.64      +13 -4     apache-2.0/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- mod_cgi.c	2000/09/18 01:24:55	1.63
  +++ mod_cgi.c	2000/10/10 04:11:35	1.64
  @@ -579,7 +579,8 @@
        */
       if (ap_should_client_block(r)) {
   	int dbsize, len_read;
  -        apr_ssize_t bytes_written;
  +        apr_ssize_t bytes_written, bytes_to_write;
  +        apr_status_t rv;
   
   	if (conf->logname) {
   	    dbuf = apr_pcalloc(r->pool, conf->bufbytes + 1);
  @@ -598,9 +599,17 @@
   		memcpy(dbuf + dbpos, argsbuffer, dbsize);
   		dbpos += dbsize;
   	    }
  -            bytes_written = len_read;
  -            (void) apr_write(script_out, argsbuffer, &bytes_written);
  -	    if (bytes_written < len_read) {
  +            /* Keep writing data to the child until done or too much time
  +             * elapses with no progress or an error occurs.
  +             */
  +            bytes_written = 0;
  +            do {
  +                bytes_to_write = len_read - bytes_written;
  +                rv = apr_write(script_out, argsbuffer + bytes_written, 
  +                               &bytes_to_write);
  +                bytes_written += bytes_to_write;
  +            } while (rv == APR_SUCCESS && bytes_written < len_read);
  +	    if (rv != APR_SUCCESS || bytes_written < len_read) {
   		/* silly script stopped reading, soak up remaining message */
   		while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) {
   		    /* dump it */
  
  
  

Mime
View raw message