diff -ur orig/php-4.0.3pl1/main/SAPI.c php-4.0.3pl1/main/SAPI.c --- orig/php-4.0.3pl1/main/SAPI.c Sat Sep 9 10:02:15 2000 +++ php-4.0.3pl1/main/SAPI.c Wed Nov 29 15:48:44 2000 @@ -40,6 +40,8 @@ #include "php_content_types.h" +#include "util_date.h" + SAPI_POST_READER_FUNC(sapi_read_standard_form_data); SAPI_POST_READER_FUNC(php_default_post_reader); @@ -443,6 +445,17 @@ SG(sapi_headers).http_response_code = 302; /* redirect */ } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */ SG(sapi_headers).http_response_code = 401; /* authentication-required */ + } else if (!STRCASECMP(header_line, "Last-Modified")) { + char *lastmodtext = colon_offset + 1; + char *ifmodtext = SG(request_info).if_modified_since; + time_t lastmoddate = ap_parseHTTPdate(lastmodtext); + time_t ifmoddate = ap_parseHTTPdate(ifmodtext); + if (lastmoddate != 0 && ifmoddate != 0 && lastmoddate <= ifmoddate) { + SG(sapi_headers).http_response_code = 304; /* not modified */ + SG(request_info).headers_only = 1; + *colon_offset = ':'; + return SUCCESS; + } } *colon_offset = ':'; } diff -ur orig/php-4.0.3pl1/main/SAPI.h php-4.0.3pl1/main/SAPI.h --- orig/php-4.0.3pl1/main/SAPI.h Sat Sep 9 10:02:15 2000 +++ php-4.0.3pl1/main/SAPI.h Wed Nov 29 15:15:03 2000 @@ -71,6 +71,7 @@ char *request_uri; char *content_type; + char *if_modified_since; unsigned char headers_only; diff -ur orig/php-4.0.3pl1/sapi/apache/mod_php4.c php-4.0.3pl1/sapi/apache/mod_php4.c --- orig/php-4.0.3pl1/sapi/apache/mod_php4.c Sat Oct 14 15:06:20 2000 +++ php-4.0.3pl1/sapi/apache/mod_php4.c Wed Nov 29 15:20:52 2000 @@ -387,6 +387,7 @@ SG(request_info).request_method = (char *)r->method; SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE"); SG(request_info).content_length = (content_length ? atoi(content_length) : 0); + SG(request_info).if_modified_since = (r->headers_in ? table_get(r->headers_in, "If-Modified-Since") : NULL); SG(sapi_headers).http_response_code = r->status; if (r->headers_in) {