ASF Bugzilla – Attachment 29237 Details for
Bug 39287
Incorrect If-Modified-Since validation (due to synthetic mtime?)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix If-Modified-Since "now" with non-mtime-aware resources, add missing APR_DATE_BAD check.
http_protocol.c.patch (text/plain), 1.92 KB, created by
Carsten Gaebler
on 2012-08-15 15:05:30 UTC
(
hide
)
Description:
Fix If-Modified-Since "now" with non-mtime-aware resources, add missing APR_DATE_BAD check.
Filename:
MIME Type:
Creator:
Carsten Gaebler
Created:
2012-08-15 15:05:30 UTC
Size:
1.92 KB
patch
obsolete
>Index: modules/http/http_protocol.c >=================================================================== >--- modules/http/http_protocol.c (revision 1373281) >+++ modules/http/http_protocol.c (working copy) >@@ -299,9 +299,10 @@ > /* All of our comparisons must be in seconds, because that's the > * highest time resolution the HTTP specification allows. > */ >- /* XXX: we should define a "time unset" constant */ >- tmp_time = ((r->mtime != 0) ? r->mtime : apr_time_now()); >- mtime = apr_time_sec(tmp_time); >+ /* XXX: we should define a "time unset" constant >+ * XXX: meanwhile we interpret 0 as unset >+ */ >+ mtime = apr_time_sec(r->mtime); > > /* If an If-Match request-header field was given > * AND the field value is not "*" (meaning match anything) >@@ -325,7 +326,8 @@ > if (if_unmodified != NULL) { > apr_time_t ius = apr_date_parse_http(if_unmodified); > >- if ((ius != APR_DATE_BAD) && (mtime > apr_time_sec(ius))) { >+ if ((ius != APR_DATE_BAD) >+ && (mtime == 0 || mtime > apr_time_sec(ius))) { > return HTTP_PRECONDITION_FAILED; > } > } >@@ -376,6 +378,7 @@ > * A date later than the server's current request time is invalid. > */ > if (r->method_number == M_GET >+ && (mtime != 0) > && (not_modified || !if_nonematch) > && (if_modified_since = > apr_table_get(r->headers_in, >@@ -384,10 +387,13 @@ > apr_int64_t ims, reqtime; > > ims_time = apr_date_parse_http(if_modified_since); >- ims = apr_time_sec(ims_time); >- reqtime = apr_time_sec(r->request_time); > >- not_modified = ims >= mtime && ims <= reqtime; >+ if (ims_time != APR_DATE_BAD) { >+ ims = apr_time_sec(ims_time); >+ reqtime = apr_time_sec(r->request_time); >+ >+ not_modified = ims >= mtime && ims <= reqtime; >+ } > } > > if (not_modified) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39287
: 29237