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

(-)mod_include.c (-17 / +8 lines)
Lines 537-543 Link Here
537
    *p = '\0';
537
    *p = '\0';
538
}
538
}
539
539
540
static void add_include_vars(request_rec *r, const char *timefmt)
540
static void add_include_vars(request_rec *r)
541
{
541
{
542
    apr_table_t *e = r->subprocess_env;
542
    apr_table_t *e = r->subprocess_env;
543
    char *t;
543
    char *t;
Lines 565-590 Link Here
565
    }
565
    }
566
}
566
}
567
567
568
static const char *add_include_vars_lazy(request_rec *r, const char *var)
568
static const char *add_include_vars_lazy(request_rec *r, const char *var, const char *timefmt)
569
{
569
{
570
    char *val;
570
    char *val;
571
    if (!strcasecmp(var, "DATE_LOCAL")) {
571
    if (!strcasecmp(var, "DATE_LOCAL")) {
572
        include_dir_config *conf =
572
        val = ap_ht_time(r->pool, r->request_time, timefmt, 0);
573
            (include_dir_config *)ap_get_module_config(r->per_dir_config,
574
                                                       &include_module);
575
        val = ap_ht_time(r->pool, r->request_time, conf->default_time_fmt, 0);
576
    }
573
    }
577
    else if (!strcasecmp(var, "DATE_GMT")) {
574
    else if (!strcasecmp(var, "DATE_GMT")) {
578
        include_dir_config *conf =
575
        val = ap_ht_time(r->pool, r->request_time, timefmt, 1);
579
            (include_dir_config *)ap_get_module_config(r->per_dir_config,
580
                                                       &include_module);
581
        val = ap_ht_time(r->pool, r->request_time, conf->default_time_fmt, 1);
582
    }
576
    }
583
    else if (!strcasecmp(var, "LAST_MODIFIED")) {
577
    else if (!strcasecmp(var, "LAST_MODIFIED")) {
584
        include_dir_config *conf =
578
        val = ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0);
585
            (include_dir_config *)ap_get_module_config(r->per_dir_config,
586
                                                       &include_module);
587
        val = ap_ht_time(r->pool, r->finfo.mtime, conf->default_time_fmt, 0);
588
    }
579
    }
589
    else if (!strcasecmp(var, "USER_NAME")) {
580
    else if (!strcasecmp(var, "USER_NAME")) {
590
        if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) {
581
        if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) {
Lines 641-647 Link Here
641
        val = apr_table_get(r->subprocess_env, var);
632
        val = apr_table_get(r->subprocess_env, var);
642
633
643
        if (val == LAZY_VALUE) {
634
        if (val == LAZY_VALUE) {
644
            val = add_include_vars_lazy(r, var);
635
            val = add_include_vars_lazy(r, var, ctx->time_str);
645
        }
636
        }
646
    }
637
    }
647
638
Lines 1806-1812 Link Here
1806
        /* get value */
1797
        /* get value */
1807
        val_text = elts[i].val;
1798
        val_text = elts[i].val;
1808
        if (val_text == LAZY_VALUE) {
1799
        if (val_text == LAZY_VALUE) {
1809
            val_text = add_include_vars_lazy(r, elts[i].key);
1800
            val_text = add_include_vars_lazy(r, elts[i].key, ctx->time_str);
1810
        }
1801
        }
1811
        val_text = ap_escape_html(ctx->dpool, elts[i].val);
1802
        val_text = ap_escape_html(ctx->dpool, elts[i].val);
1812
        v_len = strlen(val_text);
1803
        v_len = strlen(val_text);
Lines 3005-3011 Link Here
3005
         * environment */
2996
         * environment */
3006
        ap_add_common_vars(r);
2997
        ap_add_common_vars(r);
3007
        ap_add_cgi_vars(r);
2998
        ap_add_cgi_vars(r);
3008
        add_include_vars(r, conf->default_time_fmt);
2999
        add_include_vars(r);
3009
    }
3000
    }
3010
    /* Always unset the content-length.  There is no way to know if
3001
    /* Always unset the content-length.  There is no way to know if
3011
     * the content will be modified at some point by send_parsed_content.
3002
     * the content will be modified at some point by send_parsed_content.

Return to bug 39369