dgaudet 97/06/30 18:13:45
Modified: src CHANGES http_protocol.c http_request.c httpd.h Log: Added begun_read_body to request_rec so that subreqs and internal redirects won't try to read the request body twice. Submitted by: Roy Fielding Reviewed by: Alexei Kosut, Dean Gaudet Revision Changes Path 1.317 +5 -1 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.316 retrieving revision 1.317 diff -C3 -r1.316 -r1.317 *** CHANGES 1997/06/30 22:50:38 1.316 --- CHANGES 1997/07/01 01:13:40 1.317 *************** *** 92,98 **** lockfile in any location. It previously defaulted to /usr/tmp/htlock. [Somehow it took four of us: Randy Terbush, Jim Jagielski, Dean Gaudet, Marc Slemko] ! *) Add a placeholder in modules/Makefile to avoid errors with certain makes. [Marc Slemko] --- 92,102 ---- lockfile in any location. It previously defaulted to /usr/tmp/htlock. [Somehow it took four of us: Randy Terbush, Jim Jagielski, Dean Gaudet, Marc Slemko] ! ! *) Request processing now retains state of whether or not the request ! body has been read, so that internal redirects and subrequests will ! not try to read it twice (and block). [Roy Fielding] ! *) Add a placeholder in modules/Makefile to avoid errors with certain makes. [Marc Slemko] 1.130 +4 -1 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.129 retrieving revision 1.130 diff -C3 -r1.129 -r1.130 *** http_protocol.c 1997/06/29 17:56:47 1.129 --- http_protocol.c 1997/07/01 01:13:41 1.130 *************** *** 871,876 **** --- 871,877 ---- rnew->read_length = r->read_length; rnew->read_body = REQUEST_NO_BODY; + rnew->begun_read_body = r->begun_read_body; rnew->main = (request_rec *)r; } *************** *** 1348,1354 **** int should_client_block (request_rec *r) { ! if (is_HTTP_ERROR(r->status)) return 0; if (!r->read_chunked && (r->remaining <= 0)) --- 1349,1355 ---- int should_client_block (request_rec *r) { ! if (r->begun_read_body || is_HTTP_ERROR(r->status)) return 0; if (!r->read_chunked && (r->remaining <= 0)) *************** *** 1399,1404 **** --- 1400,1407 ---- int c; long len_read, len_to_read; long chunk_start = 0; + + r->begun_read_body = 1; if (!r->read_chunked) { /* Content-length read */ len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; 1.55 +2 -0 apache/src/http_request.c Index: http_request.c =================================================================== RCS file: /export/home/cvs/apache/src/http_request.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C3 -r1.54 -r1.55 *** http_request.c 1997/06/30 22:50:39 1.54 --- http_request.c 1997/07/01 01:13:42 1.55 *************** *** 1112,1117 **** --- 1112,1119 ---- */ new->no_local_copy = r->no_local_copy; + new->begun_read_body = r->begun_read_body; /* We can only read it once */ + ap_snprintf (t, sizeof(t), "%d", r->status); table_set (new->subprocess_env, "REDIRECT_STATUS", pstrdup (r->pool, t)); 1.122 +1 -0 apache/src/httpd.h Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.121 retrieving revision 1.122 diff -C3 -r1.121 -r1.122 *** httpd.h 1997/06/30 22:50:40 1.121 --- httpd.h 1997/07/01 01:13:42 1.122 *************** *** 502,507 **** --- 502,508 ---- long read_length; /* bytes that have been read */ int read_body; /* how the request body should be read */ int read_chunked; /* reading chunked transfer-coding */ + int begun_read_body; /* false (0) until first get_client_block */ /* MIME header environments, in and out. Also, an array containing * environment variables to be passed to subprocesses, so people can