/*
- * $Id: access_log.cc,v 1.55 2000/03/14 23:07:51 wessels Exp $
+ * $Id: access_log.cc,v 1.56 2000/03/25 04:58:39 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
static void accessLogSquid(AccessLogEntry * al);
static void accessLogCommon(AccessLogEntry * al);
static Logfile *logfile = NULL;
+#if HEADERS_LOG
+static Logfile *headerslog = NULL;
+#endif
#if MULTICAST_MISS_STREAM
static int mcast_miss_fd = -1;
if (NULL == logfile)
return;
logfileRotate(logfile);
+#if HEADERS_LOG
+ logfileRotate(headerslog);
+#endif
}
void
{
logfileClose(logfile);
logfile = NULL;
+#if HEADERS_LOG
+ logfileClose(headerslog);
+ headerslog = NULL;
+#endif
}
void
assert(sizeof(log_tags) == (LOG_TYPE_MAX + 1) * sizeof(char *));
logfile = logfileOpen(Config.Log.access, MAX_URL << 1);
LogfileStatus = LOG_ENABLE;
+#if HEADERS_LOG
+ headerslog = logfileOpen("/usr/local/squid/logs/headers.log", 512);
+ assert(NULL != headerslog);
+#endif
#if FORW_VIA_DB
fvdbInit();
#endif
}
#endif
+
+#if HEADERS_LOG
+void
+headersLog(int cs, int pq, method_t m, void *data)
+{
+ HttpReply *rep;
+ request_t *req;
+ unsigned short magic = 0;
+ unsigned char M = (unsigned char) m;
+ unsigned short S;
+ char *hmask;
+ int ccmask = 0;
+ if (0 == pq) {
+ /* reply */
+ rep = data;
+ req = NULL;
+ magic = 0x0050;
+ hmask = rep->header.mask;
+ if (rep->cache_control)
+ ccmask = rep->cache_control->mask;
+ } else {
+ /* request */
+ req = data;
+ rep = NULL;
+ magic = 0x0051;
+ hmask = req->header.mask;
+ if (req->cache_control)
+ ccmask = req->cache_control->mask;
+ }
+ if (0 == cs) {
+ /* client */
+ magic |= 0x4300;
+ } else {
+ /* server */
+ magic |= 0x5300;
+ }
+ magic = htons(magic);
+ ccmask = htonl(ccmask);
+ if (0 == pq)
+ S = (unsigned short) rep->sline.status;
+ else
+ S = (unsigned short) HTTP_STATUS_NONE;
+ logfileWrite(headerslog, &magic, sizeof(magic));
+ logfileWrite(headerslog, &M, sizeof(M));
+ logfileWrite(headerslog, &S, sizeof(S));
+ logfileWrite(headerslog, hmask, sizeof(HttpHeaderMask));
+ logfileWrite(headerslog, &ccmask, sizeof(int));
+ logfileFlush(headerslog);
+}
+
+#endif
/*
- * $Id: client_side.cc,v 1.471 2000/03/06 16:23:29 wessels Exp $
+ * $Id: client_side.cc,v 1.472 2000/03/25 04:58:39 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
http->out.offset += rep->hdr_sz;
check_size += rep->hdr_sz;
httpReplyDestroy(rep);
+#if HEADERS_LOG
+ headersLog(0, 0, http->request->method, rep);
+#endif
rep = NULL;
} else {
memBufDefInit(&mb);
break;
}
}
+#if HEADERS_LOG
+ headersLog(0, 1, request->method, request);
+#endif
clientAccessCheck(http);
continue; /* while offset > 0 */
} else if (parser_return_code == 0) {
/*
- * $Id: http.cc,v 1.356 2000/03/06 16:23:32 wessels Exp $
+ * $Id: http.cc,v 1.357 2000/03/25 04:58:39 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
httpState->request->host, skew);
}
ctx_exit(ctx);
+#if HEADERS_LOG
+ headersLog(1, 0, httpState->request->method, reply);
+#endif
}
static int
/*
- * $Id: protos.h,v 1.357 2000/03/14 23:11:05 wessels Exp $
+ * $Id: protos.h,v 1.358 2000/03/25 04:58:40 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void fvdbCountVia(const char *key);
extern void fvdbCountForw(const char *key);
#endif
+#if HEADERS_LOG
+extern void headersLog(int cs, int pq, method_t m, void *data);
+#endif
extern aclCheck_t *aclChecklistCreate(const struct _acl_access *,
request_t *,