diff options
author | Edward Rudd <urkle@outoforder.cc> | 2008-09-21 15:54:12 (GMT) |
---|---|---|
committer | Edward Rudd <urkle@outoforder.cc> | 2008-09-21 15:54:12 (GMT) |
commit | ba30ceeb705e9b4d40ce0d98f6a4e047d47ce919 (patch) | |
tree | 5768679317a303031c80be6cba683b6addeb07ac /src/functions13.h | |
parent | d33662354f64354c601ae257bd5b1b043c484d97 (diff) |
moved all modules source to src subdirectory.. Moved header files into include subdirectory
cleaned up makefiles.
Diffstat (limited to 'src/functions13.h')
-rw-r--r-- | src/functions13.h | 58 |
1 files changed, 58 insertions, 0 deletions
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 @@ | |||
1 | /* $Id$ */ | ||
2 | |||
3 | static const char *extract_bytes_sent(request_rec *r, char *a) | ||
4 | { | ||
5 | if (!r->sent_bodyct) { | ||
6 | return "-"; | ||
7 | } | ||
8 | else { | ||
9 | long int bs; | ||
10 | ap_bgetopt(r->connection->client, BO_BYTECT, &bs); | ||
11 | return ap_psprintf(r->pool, "%ld", bs); | ||
12 | } | ||
13 | } | ||
14 | |||
15 | static const char *extract_request_time(request_rec *r, char *a) | ||
16 | { | ||
17 | int timz; | ||
18 | struct tm *t; | ||
19 | char tstr[MAX_STRING_LEN]; | ||
20 | |||
21 | t = ap_get_gmtoff(&timz); | ||
22 | |||
23 | if (a && *a) { /* Custom format */ | ||
24 | strftime(tstr, MAX_STRING_LEN, a, t); | ||
25 | } else { /* CLF format */ | ||
26 | char sign = (timz < 0 ? '-' : '+'); | ||
27 | |||
28 | if (timz < 0) { | ||
29 | timz = -timz; | ||
30 | } | ||
31 | strftime(tstr, MAX_STRING_LEN, "[%d/%b/%Y:%H:%M:%S ", t); | ||
32 | ap_snprintf(tstr + strlen(tstr), sizeof(tstr) - strlen(tstr), "%c%.2d%.2d]", sign, timz / 60, timz % 60); | ||
33 | } | ||
34 | |||
35 | return ap_pstrdup(r->pool, tstr); | ||
36 | } | ||
37 | |||
38 | static const char *extract_request_duration(request_rec *r, char *a) | ||
39 | { | ||
40 | return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time); | ||
41 | } | ||
42 | |||
43 | static const char *extract_request_timestamp(request_rec *r, char *a) | ||
44 | { | ||
45 | return ap_psprintf(r->pool, "%ld", (long) time(NULL)); | ||
46 | } | ||
47 | static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused)); | ||
48 | static const char *extract_connection_status(request_rec *r, char *a) | ||
49 | { | ||
50 | if (r->connection->aborted) | ||
51 | return "X"; | ||
52 | |||
53 | if ((r->connection->keepalive) && | ||
54 | ((r->server->keep_alive_max - r->connection->keepalives) > 0)) { | ||
55 | return "+"; | ||
56 | } | ||
57 | return "-"; | ||
58 | } | ||