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

(-)server/util_cookies.c (-1 / +8 lines)
Lines 35-41 Link Here
35
 * @param val The value to place in the cookie.
35
 * @param val The value to place in the cookie.
36
 * @param attrs The string containing additional cookie attributes. If NULL, the
36
 * @param attrs The string containing additional cookie attributes. If NULL, the
37
 *              DEFAULT_ATTRS will be used.
37
 *              DEFAULT_ATTRS will be used.
38
 * @param maxage If non zero, a Max-Age header will be added to the cookie.
38
 * @param maxage If non zero, Max-Age and derived Expires header will be 
39
                 added to the cookie.
39
 */
40
 */
40
AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name, const char *val,
41
AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name, const char *val,
41
                                         const char *attrs, long maxage, ...)
42
                                         const char *attrs, long maxage, ...)
Lines 49-55 Link Here
49
    /* handle expiry */
50
    /* handle expiry */
50
    buffer = "";
51
    buffer = "";
51
    if (maxage) {
52
    if (maxage) {
53
        char expires[APR_RFC822_DATE_LEN];
54
52
        buffer = apr_pstrcat(r->pool, "Max-Age=", apr_ltoa(r->pool, maxage), ";", NULL);
55
        buffer = apr_pstrcat(r->pool, "Max-Age=", apr_ltoa(r->pool, maxage), ";", NULL);
56
57
        if (apr_rfc822_date(expires, apr_time_now() + apr_time_from_sec(maxage)) == APR_SUCCESS)
58
            buffer = apr_pstrcat(r->pool, buffer, "Expires=", expires, ";", NULL);
53
    }
59
    }
54
60
55
    /* create RFC2109 compliant cookie */
61
    /* create RFC2109 compliant cookie */
Lines 124-129 Link Here
124
130
125
    /* create RFC2109 compliant cookie */
131
    /* create RFC2109 compliant cookie */
126
    const char *rfc2109 = apr_pstrcat(r->pool, name, "=;Max-Age=0;",
132
    const char *rfc2109 = apr_pstrcat(r->pool, name, "=;Max-Age=0;",
133
                                "Expires=Thu, 01-Jan-1970 01:00:00 GMT;",
127
                                attrs ? attrs : CLEAR_ATTRS, NULL);
134
                                attrs ? attrs : CLEAR_ATTRS, NULL);
128
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00009) LOG_PREFIX
135
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00009) LOG_PREFIX
129
                  "user '%s' removed cookie: '%s'", r->user, rfc2109);
136
                  "user '%s' removed cookie: '%s'", r->user, rfc2109);

Return to bug 60908