diff -ur cvs/php4/main/SAPI.c php4work/main/SAPI.c --- cvs/php4/main/SAPI.c Fri Dec 1 14:36:43 2000 +++ php4work/main/SAPI.c Fri Dec 1 17:07:02 2000 @@ -399,6 +399,10 @@ /* filter out the response code */ SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line); SG(sapi_headers).http_status_line = header_line; + if (SG(sapi_headers).http_response_code == 304) { + /* Force no body when returning a 304 code */ + SG(request_info).headers_only = 1; + } return SUCCESS; } else { colon_offset = strchr(header_line, ':'); diff -ur cvs/php4/sapi/apache/mod_php4.c php4work/sapi/apache/mod_php4.c --- cvs/php4/sapi/apache/mod_php4.c Fri Nov 17 20:44:02 2000 +++ php4work/sapi/apache/mod_php4.c Fri Dec 1 17:56:01 2000 @@ -219,7 +219,16 @@ } ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code; - send_http_header((request_rec *) SG(server_context)); + if (((request_rec *) SG(server_context))->status != HTTP_NOT_MODIFIED) { + send_http_header((request_rec *) SG(server_context)); + } else { + /* + * On 304 Not Modified responses, use send_error_response + * instead so that the response has no inapplicable headers + * like Content-Type. + */ + send_error_response((request_rec *) SG(server_context), 0); + } return SAPI_HEADER_SENT_SUCCESSFULLY; }