diff options
author | Roy T. Fielding <fielding@apache.org> | 1999-08-28 00:18:49 +0200 |
---|---|---|
committer | Roy T. Fielding <fielding@apache.org> | 1999-08-28 00:18:49 +0200 |
commit | b8390cd2d210507df0f56a45f36b79e4a46d4fab (patch) | |
tree | 8248e70d00f50139cb1d77d0c26423890dd446fb | |
parent | Some cleanups. Among other things: (diff) | |
download | apache2-b8390cd2d210507df0f56a45f36b79e4a46d4fab.tar.xz apache2-b8390cd2d210507df0f56a45f36b79e4a46d4fab.zip |
Reverse the unnecessary change to the interface of ap_parseHTTPdate()
that was discovered while rebuilding the repository.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83821 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | include/util_date.h | 2 | ||||
-rw-r--r-- | modules/http/http_protocol.c | 19 | ||||
-rw-r--r-- | server/util_date.c | 8 | ||||
-rw-r--r-- | server/util_script.c | 9 |
4 files changed, 15 insertions, 23 deletions
diff --git a/include/util_date.h b/include/util_date.h index beb68e9534..8e2051024e 100644 --- a/include/util_date.h +++ b/include/util_date.h @@ -76,7 +76,7 @@ extern "C" { API_EXPORT(int) ap_checkmask(const char *data, const char *mask); API_EXPORT(time_t) ap_tm2sec(const struct tm *t); -API_EXPORT(time_t) ap_parseHTTPdate(const char *date, time_t * retval); +API_EXPORT(time_t) ap_parseHTTPdate(const char *date); #ifdef __cplusplus } diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 690914e319..618121de4a 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -428,12 +428,10 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r) */ if_unmodified = ap_table_get(r->headers_in, "If-Unmodified-Since"); if (if_unmodified != NULL) { - /* ZZZ we are changing time funcs to AP time thread funcs. - and we need to check return values of ap_parseHTTPdate. */ - time_t ius ; - if (ap_parseHTTPdate(if_unmodified, &ius) == 1 - && (mtime > ius)) { - return HTTP_PRECONDITION_FAILED; + time_t ius = ap_parseHTTPdate(if_unmodified); + + if ((ius != BAD_DATE) && (mtime > ius)) { + return HTTP_PRECONDITION_FAILED; } } } @@ -483,12 +481,9 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r) else if ((r->method_number == M_GET) && ((if_modified_since = ap_table_get(r->headers_in, "If-Modified-Since")) != NULL)) { - time_t ims; - if (ap_parseHTTPdate(if_modified_since, &ims) != 1) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, - r->server, "bogus if-modified-since-header"); - } - else if ((ims >= mtime) && (ims <= r->request_time)) { + time_t ims = ap_parseHTTPdate(if_modified_since); + + if ((ims >= mtime) && (ims <= r->request_time)) { return HTTP_NOT_MODIFIED; } } diff --git a/server/util_date.c b/server/util_date.c index 43d322eea0..5111a600f0 100644 --- a/server/util_date.c +++ b/server/util_date.c @@ -214,7 +214,7 @@ API_EXPORT(time_t) ap_tm2sec(const struct tm * t) * but many changes since then. * */ -API_EXPORT(time_t) ap_parseHTTPdate(const char *date, time_t * retval) +API_EXPORT(time_t) ap_parseHTTPdate(const char *date) { struct tm ds; int mint, mon; @@ -228,7 +228,7 @@ API_EXPORT(time_t) ap_parseHTTPdate(const char *date, time_t * retval) ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't', ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c'}; - if (!date) /* ZZZ return AP_FAILURE on all errors. */ + if (!date) return BAD_DATE; while (*date && ap_isspace(*date)) /* Find first non-whitespace char */ @@ -317,7 +317,5 @@ API_EXPORT(time_t) ap_parseHTTPdate(const char *date, time_t * retval) ds.tm_mon = mon; - /* ZZZ return AP_SUCCESS. use AP Implode time func for this. */ - *retval = ap_tm2sec(&ds); - return 1; + return ap_tm2sec(&ds); } diff --git a/server/util_script.c b/server/util_script.c index 4c300d2a29..012896d7c2 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -588,11 +588,10 @@ API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, * pass it on blindly because of restrictions on future values. */ else if (!strcasecmp(w, "Last-Modified")) { - time_t mtime; - if (ap_parseHTTPdate(l, &mtime) == 1) { - ap_update_mtime(r, mtime); - ap_set_last_modified(r); - } + time_t mtime = ap_parseHTTPdate(l); + + ap_update_mtime(r, mtime); + ap_set_last_modified(r); } else if (!strcasecmp(w, "Set-Cookie")) { ap_table_add(cookie_table, w, l); |