Commit 2b1905e6 authored by Lasse Karstensen's avatar Lasse Karstensen

works

parent 9902494d
...@@ -725,6 +725,10 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd, ...@@ -725,6 +725,10 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
case '{': { case '{': {
const char *h, *tmp; const char *h, *tmp;
char fname[100], type; char fname[100], type;
// maybe
const char *key2;
tmp = p; tmp = p;
type = 0; type = 0;
while (*tmp != '\0' && *tmp != '}') while (*tmp != '\0' && *tmp != '}')
...@@ -761,11 +765,50 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd, ...@@ -761,11 +765,50 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
VSB_cat(os, (lp->df_handling ? lp->df_handling : "-")); VSB_cat(os, (lp->df_handling ? lp->df_handling : "-"));
p = tmp; p = tmp;
break; break;
} else if (strcmp(fname, "Varnish:vcllog") == 0) { // } else if (strcmp(fname, "Varnish:vcllog") == 0) {
VSB_cat(os, (lp->log1 ? lp->log1 : "-")); // VSB_cat(os, (lp->log1 ? lp->log1 : "-"));
p = tmp; // p = tmp;
break; // break;
} }
case 'l':
// std.log("Foo: bar")
// %{Foo}l
printf("case l was hit with fname: %s\n", fname);
// Extract "Foo" from fname
char *delim;
char keyword[100];
char *kwptr;
char *startpos;
// keyword = "init";
delim = strchr(fname, ':');
printf(": found at %d\n", delim - fname);
// startpos = delim - fname;
// buffer overflow all the way.
startpos = strncpy(keyword, delim+1, sizeof keyword);
printf("meh");
printf("startpos is: %d\n", startpos);
printf("rest is: %s\n", delim+1); // startpos);
printf("keyword is: %s\n", keyword);
//keyword = delim + 1;
// printf("split2: %d\n", *split2);
// key2 = trimline(fname, split2);
//&&printf("key: %s\n", key2);
//keyword = strcpy("bar"; // trimline(fname+1, split);
//keyword = "foo";
//strcpy(key2, "bar"); // trimline(fname+1, split);
h = vcl_log(lp, keyword);
VSB_cat(os, h ? h : "-");
p = tmp;
break;
///////
default: default:
fprintf(stderr, "Unknown format starting at: %s\n", --p); fprintf(stderr, "Unknown format starting at: %s\n", --p);
......
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