/*
- * $Id$
- *
* DEBUG: section 46 Access Log - Apache combined format
* AUTHOR: Amos Jeffries
*
#include "squid.h"
#include "AccessLogEntry.h"
-#include "format/Token.h"
#include "format/Quoting.h"
+#include "format/Token.h"
+#include "globals.h"
#include "HttpRequest.h"
#include "log/File.h"
#include "log/Formats.h"
+#include "SquidConfig.h"
#include "SquidTime.h"
void
-Log::Format::HttpdCombined(AccessLogEntry * al, Logfile * logfile)
+Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile)
{
const char *user_ident = ::Format::QuoteUrlEncodeUsername(al->cache.rfc931);
+ const char *user_auth = NULL;
+ const char *referer = NULL;
+ const char *agent = NULL;
- const char *user_auth = ::Format::QuoteUrlEncodeUsername(al->cache.authuser);
+ if (al->request) {
+#if USE_AUTH
+ if (al->request->auth_user_request != NULL)
+ user_auth = ::Format::QuoteUrlEncodeUsername(al->request->auth_user_request->username());
+#endif
+ referer = al->request->header.getStr(HDR_REFERER);
+ agent = al->request->header.getStr(HDR_USER_AGENT);
+ }
- const char *referer = al->request->header.getStr(HDR_REFERER);
if (!referer || *referer == '\0')
referer = "-";
- const char *agent = al->request->header.getStr(HDR_USER_AGENT);
if (!agent || *agent == '\0')
agent = "-";
char clientip[MAX_IPSTRLEN];
al->getLogClientIp(clientip, MAX_IPSTRLEN);
- logfilePrintf(logfile, "%s %s %s [%s] \"%s %s %s/%d.%d\" %d %"PRId64" \"%s\" \"%s\" %s%s:%s%s",
+ logfilePrintf(logfile, "%s %s %s [%s] \"%s %s %s/%d.%d\" %d %" PRId64 " \"%s\" \"%s\" %s%s:%s%s",
clientip,
user_ident ? user_ident : dash_str,
user_auth ? user_auth : dash_str,
al->cache.replySize,
referer,
agent,
- ::Format::log_tags[al->cache.code],
+ LogTags_str[al->cache.code],
al->http.statusSfx(),
hier_code_str[al->hier.code],
(Config.onoff.log_mime_hdrs?"":"\n"));