From 16a624b1c2652de502ab102befdf35ac6c6d2ef9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Tue, 13 Jan 2004 02:11:14 +0000 Subject: [PATCH] weekday and monthnames are locale dependent... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102313 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/mappers/mod_rewrite.c | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 5285a4ad94..bf5c204041 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_rewrite: Cookie creation now works locale independent. + [André Malo] + *) mod_usertrack no longer inspects the Cookie2 header for the cookie name. PR 11475. [Chris Darrochi ] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 2823418bce..dd95cff9a6 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2265,21 +2265,30 @@ static void add_cookie(request_rec *r, char *s) notename = apr_pstrcat(rmain->pool, var, "_rewrite", NULL); apr_pool_userdata_get(&data, notename, rmain->pool); if (!data) { + char *exp_time = NULL; + expires = apr_strtok(NULL, ":", &tok_cntx); path = expires ? apr_strtok(NULL, ":", &tok_cntx) : NULL; + if (expires) { + apr_time_exp_t tms; + apr_time_exp_gmt(&tms, r->request_time + + apr_time_from_sec((60 * atol(expires)))); + exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d " + "%.2d:%.2d:%.2d GMT", + apr_day_snames[tms.tm_wday], + tms.tm_mday, + apr_month_snames[tms.tm_mon], + tms.tm_year+1900, + tms.tm_hour, tms.tm_min, tms.tm_sec); + } + cookie = apr_pstrcat(rmain->pool, var, "=", val, - "; path=", (path)? path : "/", + "; path=", path ? path : "/", "; domain=", domain, - (expires)? "; expires=" : NULL, - (expires)? - ap_ht_time(r->pool, - r->request_time + - apr_time_from_sec((60 * - atol(expires))), - "%a, %d-%b-%Y %T GMT", 1) - : NULL, + expires ? "; expires=" : NULL, + expires ? exp_time : NULL, NULL); apr_table_add(rmain->err_headers_out, "Set-Cookie", cookie); -- 2.50.1