1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

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

svn path=/icecast/trunk/icecast/; revision=10012
This commit is contained in:
Karl Heyes 2005-09-12 16:47:04 +00:00
parent 7838940f0b
commit 477d44dd79

View File

@ -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)
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)
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)
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,