From ba30ceeb705e9b4d40ce0d98f6a4e047d47ce919 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Sun, 21 Sep 2008 15:54:12 +0000 Subject: moved all modules source to src subdirectory.. Moved header files into include subdirectory cleaned up makefiles. --- (limited to 'src/functions13.h') diff --git a/src/functions13.h b/src/functions13.h new file mode 100644 index 0000000..54e3138 --- /dev/null +++ b/src/functions13.h @@ -0,0 +1,58 @@ +/* $Id$ */ + +static const char *extract_bytes_sent(request_rec *r, char *a) +{ + if (!r->sent_bodyct) { + return "-"; + } + else { + long int bs; + ap_bgetopt(r->connection->client, BO_BYTECT, &bs); + return ap_psprintf(r->pool, "%ld", bs); + } +} + +static const char *extract_request_time(request_rec *r, char *a) +{ + int timz; + struct tm *t; + char tstr[MAX_STRING_LEN]; + + t = ap_get_gmtoff(&timz); + + if (a && *a) { /* Custom format */ + strftime(tstr, MAX_STRING_LEN, a, t); + } else { /* CLF format */ + char sign = (timz < 0 ? '-' : '+'); + + if (timz < 0) { + timz = -timz; + } + strftime(tstr, MAX_STRING_LEN, "[%d/%b/%Y:%H:%M:%S ", t); + ap_snprintf(tstr + strlen(tstr), sizeof(tstr) - strlen(tstr), "%c%.2d%.2d]", sign, timz / 60, timz % 60); + } + + return ap_pstrdup(r->pool, tstr); +} + +static const char *extract_request_duration(request_rec *r, char *a) +{ + return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time); +} + +static const char *extract_request_timestamp(request_rec *r, char *a) +{ + return ap_psprintf(r->pool, "%ld", (long) time(NULL)); +} +static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused)); +static const char *extract_connection_status(request_rec *r, char *a) +{ + if (r->connection->aborted) + return "X"; + + if ((r->connection->keepalive) && + ((r->server->keep_alive_max - r->connection->keepalives) > 0)) { + return "+"; + } + return "-"; +} -- cgit v0.9.2