From: Stephen D. <sd...@us...> - 2005-12-11 03:33:40
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25667/nsd Modified Files: httptime.c Log Message: * nsd/httptime.c: * tests/hs_httptime.test: Use snprintf to format the date to ensure the English week and month names are always used, no matter which locale is in effect. (Bug# 1340755) Index: httptime.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/httptime.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** httptime.c 11 Dec 2005 03:17:26 -0000 1.4 --- httptime.c 11 Dec 2005 03:33:30 -0000 1.5 *************** *** 56,59 **** --- 56,63 ---- }; + static CONST char *week_names[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + #ifdef HAVE_TIMEGM static Ns_Mutex lock; *************** *** 96,104 **** /* ! * This will most likely break if the locale is not an english one. ! * The format is RFC 1123: "Sun, 06 Nov 1997 09:12:45 GMT" */ ! strftime(buf, 40, "%a, %d %b %Y %H:%M:%S GMT", tmPtr); Ns_DStringAppend(pds, buf); --- 100,112 ---- /* ! * The format is RFC 1123 "Sun, 06 Nov 1997 09:12:45 GMT" ! * and is locale independant, so English week and month names ! * must always be used. */ ! snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", ! week_names[tmPtr->tm_wday], tmPtr->tm_mday, ! month_names[tmPtr->tm_mon], tmPtr->tm_year + 1900, ! tmPtr->tm_hour, tmPtr->tm_min, tmPtr->tm_sec); Ns_DStringAppend(pds, buf); |