Commit 477d44dd authored by Karl Heyes's avatar Karl Heyes

log username to access log (bug #706) if available.

svn path=/icecast/trunk/icecast/; revision=10012
parent 7838940f
...@@ -95,12 +95,11 @@ int get_clf_time (char *buffer, unsigned len, struct tm *t) ...@@ -95,12 +95,11 @@ int get_clf_time (char *buffer, unsigned len, struct tm *t)
} }
#endif #endif
/* /*
** ADDR USER AUTH DATE REQUEST CODE BYTES REFERER AGENT [TIME] ** ADDR IDENT USER DATE REQUEST CODE BYTES REFERER AGENT [TIME]
** **
** ADDR = client->con->ip ** ADDR = client->con->ip
** USER = - ** IDENT = always - , we don't support it because it's useless
** we should do this for real once we support authentication ** USER = client->username
** AUTH = -
** DATE = _make_date(client->con->con_time) ** DATE = _make_date(client->con->con_time)
** REQUEST = build from client->parser ** REQUEST = build from client->parser
** CODE = client->respcode ** CODE = client->respcode
...@@ -116,7 +115,7 @@ void logging_access(client_t *client) ...@@ -116,7 +115,7 @@ void logging_access(client_t *client)
struct tm thetime; struct tm thetime;
time_t now; time_t now;
time_t stayed; time_t stayed;
char *referrer, *user_agent; char *referrer, *user_agent, *username;
now = time(NULL); now = time(NULL);
...@@ -137,6 +136,11 @@ void logging_access(client_t *client) ...@@ -137,6 +136,11 @@ void logging_access(client_t *client)
stayed = now - client->con->con_time; stayed = now - client->con->con_time;
if (client->username == NULL)
username = "-";
else
username = client->username;
referrer = httpp_getvar (client->parser, "referer"); referrer = httpp_getvar (client->parser, "referer");
if (referrer == NULL) if (referrer == NULL)
referrer = "-"; referrer = "-";
...@@ -146,8 +150,9 @@ void logging_access(client_t *client) ...@@ -146,8 +150,9 @@ void logging_access(client_t *client)
user_agent = "-"; user_agent = "-";
log_write_direct (accesslog, log_write_direct (accesslog,
"%s - - [%s] \"%s\" %d " FORMAT_UINT64 " \"%s\" \"%s\" %lu", "%s - %s [%s] \"%s\" %d " FORMAT_UINT64 " \"%s\" \"%s\" %lu",
client->con->ip, client->con->ip,
username,
datebuf, datebuf,
reqbuf, reqbuf,
client->respcode, client->respcode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment