Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
1338e18b
Commit
1338e18b
authored
Apr 14, 2017
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shuffle things around in prep for upcoming work
parent
0dffccfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
+34
-27
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+34
-27
No files found.
bin/varnishncsa/varnishncsa.c
View file @
1338e18b
...
...
@@ -804,11 +804,10 @@ parse_format(const char *format)
}
static
int
isprefix
(
const
char
*
prefix
,
const
char
*
b
,
const
char
*
e
,
const
char
**
next
)
isprefix
(
const
char
*
prefix
,
size_t
len
,
const
char
*
b
,
const
char
*
e
,
const
char
**
next
)
{
size_t
len
;
len
=
strlen
(
prefix
);
assert
(
len
>
0
);
if
(
e
-
b
<
len
||
strncasecmp
(
b
,
prefix
,
len
))
return
(
0
);
b
+=
len
;
...
...
@@ -897,6 +896,24 @@ process_hdr(const struct watch_head *head, const char *b, const char *e)
}
}
static
void
process_vsl
(
const
struct
vsl_watch_head
*
head
,
enum
VSL_tag_e
tag
,
const
char
*
b
,
const
char
*
e
)
{
struct
vsl_watch
*
w
;
VTAILQ_FOREACH
(
w
,
head
,
list
)
{
CHECK_OBJ_NOTNULL
(
w
,
VSL_WATCH_MAGIC
);
if
(
tag
!=
w
->
tag
)
continue
;
if
(
w
->
idx
==
0
)
frag_line
(
0
,
b
,
e
,
&
w
->
frag
);
else
frag_fields
(
0
,
b
,
e
,
w
->
idx
,
&
w
->
frag
,
0
,
NULL
);
}
}
static
int
__match_proto__
(
VSLQ_dispatch_f
)
dispatch_f
(
struct
VSL_data
*
vsl
,
struct
VSL_transaction
*
const
pt
[],
void
*
priv
)
...
...
@@ -905,7 +922,6 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
unsigned
tag
;
const
char
*
b
,
*
e
,
*
p
;
struct
watch
*
w
;
struct
vsl_watch
*
vslw
;
int
i
,
skip
,
be_mark
;
(
void
)
vsl
;
(
void
)
priv
;
...
...
@@ -991,32 +1007,34 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
break
;
case
(
SLT_Timestamp
+
BACKEND_MARKER
):
case
SLT_Timestamp
:
if
(
isprefix
(
"Start:"
,
b
,
e
,
&
p
))
{
#define PREFIX(a, b, c, d) isprefix(a, strlen(a), b, c, d)
if
(
PREFIX
(
"Start:"
,
b
,
e
,
&
p
))
{
frag_fields
(
0
,
p
,
e
,
1
,
&
CTX
.
frag
[
F_tstart
],
0
,
NULL
);
}
else
if
(
isprefix
(
"Resp:"
,
b
,
e
,
&
p
)
||
isprefix
(
"PipeSess:"
,
b
,
e
,
&
p
)
||
isprefix
(
"BerespBody:"
,
b
,
e
,
&
p
))
{
}
else
if
(
PREFIX
(
"Resp:"
,
b
,
e
,
&
p
)
||
PREFIX
(
"PipeSess:"
,
b
,
e
,
&
p
)
||
PREFIX
(
"BerespBody:"
,
b
,
e
,
&
p
))
{
frag_fields
(
0
,
p
,
e
,
1
,
&
CTX
.
frag
[
F_tend
],
0
,
NULL
);
}
else
if
(
isprefix
(
"Process:"
,
b
,
e
,
&
p
)
||
isprefix
(
"Pipe:"
,
b
,
e
,
&
p
)
||
isprefix
(
"Beresp:"
,
b
,
e
,
&
p
))
{
}
else
if
(
PREFIX
(
"Process:"
,
b
,
e
,
&
p
)
||
PREFIX
(
"Pipe:"
,
b
,
e
,
&
p
)
||
PREFIX
(
"Beresp:"
,
b
,
e
,
&
p
))
{
frag_fields
(
0
,
p
,
e
,
2
,
&
CTX
.
frag
[
F_ttfb
],
0
,
NULL
);
}
break
;
case
(
SLT_BereqHeader
+
BACKEND_MARKER
):
case
SLT_ReqHeader
:
if
(
isprefix
(
"Authorization:"
,
b
,
e
,
&
p
)
&&
isprefix
(
"basic "
,
p
,
e
,
&
p
))
if
(
PREFIX
(
"Authorization:"
,
b
,
e
,
&
p
)
&&
PREFIX
(
"basic "
,
p
,
e
,
&
p
))
frag_line
(
0
,
p
,
e
,
&
CTX
.
frag
[
F_auth
]);
else
if
(
isprefix
(
"Host:"
,
b
,
e
,
&
p
))
else
if
(
PREFIX
(
"Host:"
,
b
,
e
,
&
p
))
frag_line
(
0
,
p
,
e
,
&
CTX
.
frag
[
F_host
]);
#undef PREFIX
break
;
case
SLT_VCL_call
:
if
(
!
strcasecmp
(
b
,
"recv"
))
{
...
...
@@ -1073,18 +1091,7 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
(
tag
==
SLT_BerespHeader
&&
CTX
.
b_opt
))
process_hdr
(
&
CTX
.
watch_resphdr
,
b
,
e
);
VTAILQ_FOREACH
(
vslw
,
&
CTX
.
watch_vsl
,
list
)
{
CHECK_OBJ_NOTNULL
(
vslw
,
VSL_WATCH_MAGIC
);
if
(
tag
==
vslw
->
tag
)
{
if
(
vslw
->
idx
==
0
)
frag_line
(
0
,
b
,
e
,
&
vslw
->
frag
);
else
frag_fields
(
0
,
b
,
e
,
vslw
->
idx
,
&
vslw
->
frag
,
0
,
NULL
);
}
}
process_vsl
(
&
CTX
.
watch_vsl
,
tag
,
b
,
e
);
}
if
(
skip
)
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment