From 3d3fa591d770c2b046ff8f51e85bd8dafc1dfa56 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sat, 7 Oct 2006 12:45:10 +0000 Subject: [PATCH] - don't raise notice when checking If-Range header for a last modification date --- http_cache_api.c | 2 +- http_date_api.c | 4 ++-- php_http_date_api.h | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/http_cache_api.c b/http_cache_api.c index 9a6ea89..adba374 100644 --- a/http_cache_api.c +++ b/http_cache_api.c @@ -85,7 +85,7 @@ PHP_HTTP_API zend_bool _http_match_last_modified_ex(const char *entry, time_t t, chr_ptr = 0; } - retval = (t <= http_parse_date(modified)); + retval = (t <= http_parse_date_ex(modified, 1)); efree(modified); return retval; } diff --git a/http_date_api.c b/http_date_api.c index 10f3463..32efdfb 100644 --- a/http_date_api.c +++ b/http_date_api.c @@ -159,7 +159,7 @@ PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC) /* }}} */ /* {{{ time_t http_parse_date(char *) */ -PHP_HTTP_API time_t _http_parse_date(const char *date TSRMLS_DC) +PHP_HTTP_API time_t _http_parse_date_ex(const char *date, zend_bool silent TSRMLS_DC) { time_t t = -1; @@ -180,7 +180,7 @@ PHP_HTTP_API time_t _http_parse_date(const char *date TSRMLS_DC) putenv(tzput); #endif - if (-1 == t) { + if (-1 == t && !silent) { http_error_ex(HE_NOTICE, HTTP_E_RUNTIME, "Could not parse date: %s", date); } diff --git a/php_http_date_api.h b/php_http_date_api.h index 3356e38..948f6e8 100644 --- a/php_http_date_api.h +++ b/php_http_date_api.h @@ -18,8 +18,9 @@ #define http_date(t) _http_date((t) TSRMLS_CC) PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC); -#define http_parse_date(d) _http_parse_date((d) TSRMLS_CC) -PHP_HTTP_API time_t _http_parse_date(const char *date TSRMLS_DC); +#define http_parse_date(d) _http_parse_date_ex((d), 0 TSRMLS_CC) +#define http_parse_date_ex(d, s) _http_parse_date_ex((d), (s) TSRMLS_CC) +PHP_HTTP_API time_t _http_parse_date_ex(const char *date, zend_bool silent TSRMLS_DC); #endif -- 2.30.2