View | Details | Raw Unified | Return to bug 39287
Collapse All | Expand All

(-)modules/http/http_protocol.c (-7 / +13 lines)
Lines 299-307 Link Here
299
    /* All of our comparisons must be in seconds, because that's the
299
    /* All of our comparisons must be in seconds, because that's the
300
     * highest time resolution the HTTP specification allows.
300
     * highest time resolution the HTTP specification allows.
301
     */
301
     */
302
    /* XXX: we should define a "time unset" constant */
302
    /* XXX: we should define a "time unset" constant
303
    tmp_time = ((r->mtime != 0) ? r->mtime : apr_time_now());
303
     * XXX: meanwhile we interpret 0 as unset
304
    mtime =  apr_time_sec(tmp_time);
304
     */
305
    mtime = apr_time_sec(r->mtime);
305
306
306
    /* If an If-Match request-header field was given
307
    /* If an If-Match request-header field was given
307
     * AND the field value is not "*" (meaning match anything)
308
     * AND the field value is not "*" (meaning match anything)
Lines 325-331 Link Here
325
        if (if_unmodified != NULL) {
326
        if (if_unmodified != NULL) {
326
            apr_time_t ius = apr_date_parse_http(if_unmodified);
327
            apr_time_t ius = apr_date_parse_http(if_unmodified);
327
328
328
            if ((ius != APR_DATE_BAD) && (mtime > apr_time_sec(ius))) {
329
            if ((ius != APR_DATE_BAD)
330
                && (mtime == 0 || mtime > apr_time_sec(ius))) {
329
                return HTTP_PRECONDITION_FAILED;
331
                return HTTP_PRECONDITION_FAILED;
330
            }
332
            }
331
        }
333
        }
Lines 376-381 Link Here
376
     * A date later than the server's current request time is invalid.
378
     * A date later than the server's current request time is invalid.
377
     */
379
     */
378
    if (r->method_number == M_GET
380
    if (r->method_number == M_GET
381
        && (mtime != 0)
379
        && (not_modified || !if_nonematch)
382
        && (not_modified || !if_nonematch)
380
        && (if_modified_since =
383
        && (if_modified_since =
381
              apr_table_get(r->headers_in,
384
              apr_table_get(r->headers_in,
Lines 384-393 Link Here
384
        apr_int64_t ims, reqtime;
387
        apr_int64_t ims, reqtime;
385
388
386
        ims_time = apr_date_parse_http(if_modified_since);
389
        ims_time = apr_date_parse_http(if_modified_since);
387
        ims = apr_time_sec(ims_time);
388
        reqtime = apr_time_sec(r->request_time);
389
390
390
        not_modified = ims >= mtime && ims <= reqtime;
391
        if (ims_time != APR_DATE_BAD) {
392
            ims = apr_time_sec(ims_time);
393
            reqtime = apr_time_sec(r->request_time);
394
395
            not_modified = ims >= mtime && ims <= reqtime;
396
        }
391
    }
397
    }
392
398
393
    if (not_modified) {
399
    if (not_modified) {

Return to bug 39287