summaryrefslogtreecommitdiff
path: root/server/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/log.c')
-rw-r--r--server/log.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/server/log.c b/server/log.c
index 6295f1a89c..f3347d9834 100644
--- a/server/log.c
+++ b/server/log.c
@@ -573,14 +573,32 @@ static int log_ctime(const ap_errorlog_info *info, const char *arg,
int time_len = buflen;
int option = AP_CTIME_OPTION_NONE;
- while (arg && *arg) {
- switch (*arg) {
- case 'u': option |= AP_CTIME_OPTION_USEC;
- break;
- case 'c': option |= AP_CTIME_OPTION_COMPACT;
- break;
+ if (arg) {
+ if (arg[0] == 'u' && !arg[1]) { /* no ErrorLogFormat (fast path) */
+ option |= AP_CTIME_OPTION_USEC;
+ }
+ else if (!ap_strchr_c(arg, '%')) { /* special "%{cuz}t" formats */
+ while (*arg) {
+ switch (*arg++) {
+ case 'u':
+ option |= AP_CTIME_OPTION_USEC;
+ break;
+ case 'c':
+ option |= AP_CTIME_OPTION_COMPACT;
+ break;
+ case 'z':
+ option |= AP_CTIME_OPTION_GMTOFF;
+ break;
+ }
+ }
+ }
+ else { /* "%{strftime %-format}t" */
+ apr_size_t len = 0;
+ apr_time_exp_t expt;
+ ap_explode_recent_localtime(&expt, apr_time_now());
+ apr_strftime(buf, &len, buflen, arg, &expt);
+ return (int)len;
}
- arg++;
}
ap_recent_ctime_ex(buf, apr_time_now(), option, &time_len);