fielding 98/08/01 21:43:19
Modified: src CHANGES src/main http_main.c http_protocol.c Log: Allow ap_read_request errors to propagate through the normal request handling loop so that the connection can be properly closed with lingering_close, thus avoiding a potential TCP reset that would cause the client to miss the HTTP error response. Revision Changes Path 1.993 +5 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.992 retrieving revision 1.993 diff -u -r1.992 -r1.993 --- CHANGES 1998/07/28 17:26:43 1.992 +++ CHANGES 1998/08/02 04:43:15 1.993 @@ -1,5 +1,10 @@ Changes with Apache 1.3.2 + *) Allow ap_read_request errors to propagate through the normal request + handling loop so that the connection can be properly closed with + lingering_close, thus avoiding a potential TCP reset that would + cause the client to miss the HTTP error response. [Roy Fielding] + *) One more portability fix for APACI shadow tree support: Swap order of awk and sed in top-level configure script to avoid sed fails on some platforms (for instance SunOS 4.1.3 and NCR SysV) because of the 1.376 +14 -9 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.375 retrieving revision 1.376 diff -u -r1.375 -r1.376 --- http_main.c 1998/07/20 16:37:11 1.375 +++ http_main.c 1998/08/02 04:43:17 1.376 @@ -3699,8 +3699,11 @@ (void) ap_update_child_status(my_child_num, SERVER_BUSY_WRITE, r); - ap_process_request(r); + /* process the request if it was read without error */ + if (r->status == HTTP_OK) + ap_process_request(r); + #if defined(STATUS) increment_counts(my_child_num, r); #endif @@ -4466,15 +4469,16 @@ conn = new_connection(ptrans, server_conf, cio, (struct sockaddr_in *) &sa_client, (struct sockaddr_in *) &sa_server, -1); - r = ap_read_request(conn); - if (r) - ap_process_request(r); /* else premature EOF (ignore) */ - while (r && conn->keepalive && !conn->aborted) { - ap_destroy_pool(r->pool); - r = ap_read_request(conn); - if (r) + while ((r = ap_read_request(conn)) != NULL) { + + if (r->status == HTTP_OK) ap_process_request(r); + + if (!conn->keepalive || conn->aborted) + break; + + ap_destroy_pool(r->pool); } ap_bclose(cio); @@ -4779,7 +4783,8 @@ while ((r = ap_read_request(current_conn)) != NULL) { (void) ap_update_child_status(child_num, SERVER_BUSY_WRITE, r); - ap_process_request(r); + if (r->status == HTTP_OK) + ap_process_request(r); #if defined(STATUS) increment_counts(child_num, r); 1.227 +2 -3 apache-1.3/src/main/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v retrieving revision 1.226 retrieving revision 1.227 diff -u -r1.226 -r1.227 --- http_protocol.c 1998/07/22 05:48:21 1.226 +++ http_protocol.c 1998/08/02 04:43:18 1.227 @@ -803,8 +803,8 @@ ap_send_error_response(r, 0); ap_bflush(r->connection->client); ap_log_transaction(r); + return r; } - r->connection->aborted = 1; return NULL; } if (!r->assbackwards) { @@ -819,8 +819,7 @@ ap_send_error_response(r, 0); ap_bflush(r->connection->client); ap_log_transaction(r); - r->connection->aborted = 1; - return NULL; + return r; } } else {