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

(-)modules/metadata/mod_expires.c (-2 / +7 lines)
Lines 397-402 Link Here
397
    apr_time_t base;
397
    apr_time_t base;
398
    apr_time_t additional;
398
    apr_time_t additional;
399
    apr_time_t expires;
399
    apr_time_t expires;
400
    apr_time_t e;
400
    int additional_sec;
401
    int additional_sec;
401
    char *timestr;
402
    char *timestr;
402
403
Lines 428-438 Link Here
428
                    "internal error: bad expires code: %s", r->filename);
429
                    "internal error: bad expires code: %s", r->filename);
429
        return HTTP_INTERNAL_SERVER_ERROR;
430
        return HTTP_INTERNAL_SERVER_ERROR;
430
    }
431
    }
431
432
    /* Do not let max-age be negetive.
433
     */
434
    e = apr_time_sec(base - r->request_time) + apr_time_sec(additional);
435
    if (e < 0) e = APR_INT64_MAX;
432
    expires = base + additional;
436
    expires = base + additional;
437
    if (expires < 0) expires = APR_INT64_MAX;
433
    apr_table_mergen(t, "Cache-Control",
438
    apr_table_mergen(t, "Cache-Control",
434
                     apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
439
                     apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
435
                                  apr_time_sec(expires - r->request_time)));
440
                                  e));
436
    timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
441
    timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
437
    apr_rfc822_date(timestr, expires);
442
    apr_rfc822_date(timestr, expires);
438
    apr_table_setn(t, "Expires", timestr);
443
    apr_table_setn(t, "Expires", timestr);

Return to bug 41391