Commit 15e4f620 authored by Lasse Karstensen's avatar Lasse Karstensen

the somewhat correct parts

parent 831318ad
...@@ -105,8 +105,7 @@ static struct logline { ...@@ -105,8 +105,7 @@ static struct logline {
uint64_t bitmap; /* Bitmap for regex matches */ uint64_t bitmap; /* Bitmap for regex matches */
VTAILQ_HEAD(, hdr) req_headers; /* Request headers */ VTAILQ_HEAD(, hdr) req_headers; /* Request headers */
VTAILQ_HEAD(, hdr) resp_headers; /* Response headers */ VTAILQ_HEAD(, hdr) resp_headers; /* Response headers */
char *log1; /* How the request was handled (hit/miss/pass/pipe) */ VTAILQ_HEAD(, hdr) vcl_log; /* VLC_Log entries */
// VTAILQ_HEAD(, hdr) vcl_log; /* vcl.log() entries */
} **ll; } **ll;
struct VSM_data *vd; struct VSM_data *vd;
...@@ -222,8 +221,7 @@ static char * ...@@ -222,8 +221,7 @@ static char *
vcl_log(struct logline *l, const char *name) vcl_log(struct logline *l, const char *name)
{ {
struct hdr *h; struct hdr *h;
// JEJE VTAILQ_FOREACH(h, &l->vcl_log, list) {
VTAILQ_FOREACH(h, &l->resp_headers, list) {
if (strcasecmp(h->key, name) == 0) { if (strcasecmp(h->key, name) == 0) {
return h->value; return h->value;
break; break;
...@@ -261,6 +259,14 @@ clean_logline(struct logline *lp) ...@@ -261,6 +259,14 @@ clean_logline(struct logline *lp)
freez(h->value); freez(h->value);
freez(h); freez(h);
} }
VTAILQ_FOREACH_SAFE(h, &lp->vcl_log, list, h2) {
VTAILQ_REMOVE(&lp->vcl_log, h, list);
freez(h->key);
freez(h->value);
freez(h);
}
#undef freez #undef freez
memset(lp, 0, sizeof *lp); memset(lp, 0, sizeof *lp);
} }
...@@ -484,22 +490,24 @@ collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec, ...@@ -484,22 +490,24 @@ collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
case SLT_VCL_Log: case SLT_VCL_Log:
if(!lp->active) if(!lp->active)
break; break;
lp->log1 = trimline(ptr, end); //lp->log1 = trimline(ptr, end);
/*
if (strncmp(ptr, "hit", len) == 0) { // Extract key, value from logline.
lp->df_hitmiss = "hit"; split = strchr(ptr, ':');
lp->df_handling = "hit"; if (split == NULL)
} else if (strncmp(ptr, "miss", len) == 0) {
lp->df_hitmiss = "miss";
lp->df_handling = "miss";
} else if (strncmp(ptr, "pass", len) == 0) {
lp->df_hitmiss = "miss";
lp->df_handling = "pass";
} else if (strncmp(ptr, "pipe", len) == 0) {
clean_logline(lp);
break; break;
}
*/ struct hdr *h;
h = malloc(sizeof(struct hdr));
// XXX: what is this AN() business? probably important. :)
AN(h);
AN(split);
h->key = trimline(ptr, split);
h->value = trimline(split+1, end);
// put onto the linked list that is log entries.
VTAILQ_INSERT_HEAD(&lp->vcl_log, h, list);
break; break;
......
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