brian 98/05/05 19:29:59 Modified: src CHANGES Log: PR: 754 Submitted by: Paul Eggert <[EMAIL PROTECTED]> Fix handling of %Z in timefmt strings for those platforms with no time zone information in their tm struct. [ Revision Changes Path 1.821 +4 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.820 retrieving revision 1.821 diff -u -r1.820 -r1.821 --- CHANGES 1998/05/06 01:19:11 1.820 +++ CHANGES 1998/05/06 02:29:46 1.821 @@ -1,5 +1,9 @@ Changes with Apache 1.3b7 + *) Fix handling of %Z in timefmt strings for those platforms with no time + zone information in their tm struct. [Paul Eggert <[EMAIL PROTECTED]>] + PR #754 + *) Makes mod_rewrite, mod_log_config, mod_status and the ServerSignature feature compatible with 'UseCanonicalName off' by changing r->server->server_hostname to ap_get_server_name(). And I changed some
Modified: src/main util.c Log: PR: 754 Submitted by: Paul Eggert <[EMAIL PROTECTED]> Fix handling of %Z in timefmt strings for those platforms with no time zone information in their tm struct. Revision Changes Path 1.113 +34 -0 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -r1.112 -r1.113 --- util.c 1998/04/13 18:05:12 1.112 +++ util.c 1998/05/06 02:29:59 1.113 @@ -122,9 +122,43 @@ API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt) { char ts[MAX_STRING_LEN]; + char tf[MAX_STRING_LEN]; struct tm *tms; tms = (gmt ? gmtime(&t) : localtime(&t)); + if(gmt) { + /* Convert %Z to "GMT" and %z to "+0000"; + * on hosts that do not have a time zone string in struct tm, + * strftime must assume its argument is local time. + */ + const char *f; + char *p; + for(p = tf, f = fmt; p < tf + sizeof tf - 5 && (*p = *f); f++, p++) { + if(*f == '%') + switch(f[1]) + { + case '%': + *++p = *++f; + break; + case 'Z': + *p++ = 'G'; + *p++ = 'M'; + *p = 'T'; + f++; + break; + case 'z': /* common extension */ + *p++ = '+'; + *p++ = '0'; + *p++ = '0'; + *p++ = '0'; + *p = '0'; + f++; + break; + } + } + *p = '\0'; + fmt = tf; + } /* check return code? */ strftime(ts, MAX_STRING_LEN, fmt, tms);