You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2002/05/31 09:37:19 UTC
cvs commit: httpd-2.0/modules/http http_request.c
jerenkrantz 2002/05/31 00:37:19
Modified: modules/http http_request.c
Log:
Fix the case where we generate both a 401 and 413 and we go bonkers.
- If an error would drop the connection, we do not return the top-level
error anymore as we will assume this new one takes precedence over the
original error. This also ensures that we will not read the input
body (which is the point of returning these special error messages in
the first place).
- The ap_discard_request_body return value in ap_die() must be checked
to make sure we don't encounter this recursive case and print two errors.
Kudos to Jeff Trawick for his sample input which pointed this out.
Revision Changes Path
1.145 +8 -4 httpd-2.0/modules/http/http_request.c
Index: http_request.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- http_request.c 28 May 2002 23:38:31 -0000 1.144
+++ http_request.c 31 May 2002 07:37:19 -0000 1.145
@@ -117,8 +117,7 @@
* error condition, we just report on the original error, and give up on
* any attempt to handle the other thing "intelligently"...
*/
-
- if (r->status != HTTP_OK) {
+ if (r->status != HTTP_OK && !ap_status_drops_connection(type)) {
recursive_error = type;
while (r->prev && (r->prev->status != HTTP_OK))
@@ -149,8 +148,13 @@
else if ((r->status != HTTP_NOT_MODIFIED) &&
(r->status != HTTP_NO_CONTENT) &&
r->connection && (r->connection->keepalive != -1)) {
-
- (void) ap_discard_request_body(r);
+ /* If the discard returns AP_FILTER_ERROR, it means that we went
+ * recursive on ourselves and we should abort.
+ */
+ int errstatus = ap_discard_request_body(r);
+ if (errstatus == AP_FILTER_ERROR) {
+ return;
+ }
}
/*