www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann 'PoV' Coupin <...@club-internet.fr>
Subject Re: mod_include/8041: Cannot specify locale which apply to date formating
Date Mon, 10 Sep 2001 17:08:26 GMT
Here's an updated version of the patch which is much rigorous in preserving the locale to the
locale active before the call in order to not mangle the log file.

Must be applied on mod_include.c
----------------------------------------
95a96
> #include "locale.h"
101a103
> #define DEFAULT_TIME_LOCALE "C"
1022c1024
< static int handle_config(FILE *in, request_rec *r, char *error, char *tf,
---
> static int handle_config(FILE *in, request_rec *r, char *error, char *tf, char *tl,
1036a1039,1053
>         else if (!strcmp(tag, "lc_time")) {
>         	char currentlocale[MAX_STRING_LEN];
>             time_t date = r->request_time;
> 
>         	parse_string(r, tag_val, tl, MAX_STRING_LEN, 0);
>        	    ap_cpystrn(currentlocale, setlocale(LC_TIME, NULL), sizeof(currentlocale));
>         	setlocale(LC_TIME, tl);
> 
>             ap_table_setn(env, "DATE_LOCAL", ap_ht_time(r->pool, date, tf, 0));
>             ap_table_setn(env, "DATE_GMT", ap_ht_time(r->pool, date, tf, 1));
>             ap_table_setn(env, "LAST_MODIFIED",
>                       ap_ht_time(r->pool, r->finfo.st_mtime, tf, 0));
>                       
>             setlocale(LC_TIME, currentlocale);
>         }
1037a1055
>         	char currentlocale[MAX_STRING_LEN];
1039a1058,1060
>        	    ap_cpystrn(currentlocale, setlocale(LC_TIME, NULL), sizeof(currentlocale));
>         	setlocale(LC_TIME, tl);
> 
1044a1066,1067
> 
>             setlocale(LC_TIME, currentlocale);
1179c1202
< static int handle_flastmod(FILE *in, request_rec *r, const char *error, const char *tf)
---
> static int handle_flastmod(FILE *in, request_rec *r, const char *error, const char *tf,
const char *tl)
1195a1219,1222
> 	        	char currentlocale[MAX_STRING_LEN];
> 	       	    ap_cpystrn(currentlocale, setlocale(LC_TIME, NULL), sizeof(currentlocale));
> 	        	setlocale(LC_TIME, tl);
> 
1196a1224,1225
> 
> 	            setlocale(LC_TIME, currentlocale);
2174a2204
>     char timelocale[MAX_STRING_LEN];
2182a2213
>     ap_cpystrn(timelocale, DEFAULT_TIME_LOCALE, sizeof(timelocale));
2263c2294
<                 ret = handle_config(f, r, error, timefmt, &sizefmt);
---
>                 ret = handle_config(f, r, error, timefmt, timelocale, &sizefmt);
2278c2309
<                 ret = handle_flastmod(f, r, error, timefmt);
---
>                 ret = handle_flastmod(f, r, error, timefmt, timelocale);


Mime
View raw message