You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Robert S. Thau" <rs...@ai.mit.edu> on 1996/06/15 16:47:20 UTC
Another patch...
This is at least meant to make Apache behave a little more sensibly
when a script stops reading output early (or the pipe just gets
jammed). I believe this is the bug that Mark Weiser was raising hell
about at www5...
diff -c ../src.dist.ref/mod_cgi.c ./mod_cgi.c
*** ../src.dist.ref/mod_cgi.c Sat Jun 15 10:05:48 1996
--- ./mod_cgi.c Sat Jun 15 10:25:14 1996
***************
*** 308,315 ****
len_read = read_client_block (r, argsbuffer, len_to_read);
if (len_read == 0)
break;
! fwrite (argsbuffer, 1, len_read, script_out);
remaining -= len_read;
}
fflush (script_out);
--- 308,328 ----
len_read = read_client_block (r, argsbuffer, len_to_read);
if (len_read == 0)
break;
! if (fwrite (argsbuffer, 1, len_read, script_out) == 0)
! break;
remaining -= len_read;
+ }
+
+ /* If script stopped reading early, soak up remaining stuff from
+ * client...
+ */
+
+ while (remaining > 0) {
+ int len_read, len_to_read = remaining;
+ if (len_to_read > HUGE_STRING_LEN) len_to_read = HUGE_STRING_LEN;
+
+ len_read = read_client_block (r, argsbuffer, len_to_read);
+ if (len_read == 0) break;
}
fflush (script_out);