static u_char ngx_http_ssi_string[] = "<!--";
static ngx_str_t ngx_http_ssi_none = ngx_string("(none)");
+static ngx_str_t ngx_http_ssi_timefmt = ngx_string("%A, %d-%b-%Y %H:%M:%S %Z");
static ngx_str_t ngx_http_ssi_null_string = ngx_null_string;
ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N;
ctx->params.pool = r->pool;
- ngx_str_set(&ctx->timefmt, "%A, %d-%b-%Y %H:%M:%S %Z");
+ ctx->timefmt = ngx_http_ssi_timefmt;
ngx_str_set(&ctx->errmsg,
"[an error occurred while processing the directive]");
{
ngx_http_ssi_ctx_t *ctx;
ngx_time_t *tp;
+ ngx_str_t *timefmt;
struct tm tm;
char buf[NGX_HTTP_SSI_DATE_LEN];
ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module);
- if (ctx == NULL
- || (ctx->timefmt.len == sizeof("%s") - 1
- && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's'))
+ timefmt = ctx ? &ctx->timefmt : &ngx_http_ssi_timefmt;
+
+ if (timefmt->len == sizeof("%s") - 1
+ && timefmt->data[0] == '%' && timefmt->data[1] == 's')
{
v->data = ngx_pnalloc(r->pool, NGX_TIME_T_LEN);
if (v->data == NULL) {
}
v->len = strftime(buf, NGX_HTTP_SSI_DATE_LEN,
- (char *) ctx->timefmt.data, &tm);
+ (char *) timefmt->data, &tm);
if (v->len == 0) {
return NGX_ERROR;
}