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
81478a1f
Commit
81478a1f
authored
Apr 19, 2017
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup
parent
cf3d1724
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
27 deletions
+17
-27
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+17
-27
No files found.
bin/varnishncsa/varnishncsa.c
View file @
81478a1f
...
...
@@ -514,7 +514,7 @@ addf_requestline(void)
}
static
void
addf_vcl_log
(
const
char
*
key
,
const
char
*
str
)
addf_vcl_log
(
const
char
*
key
)
{
struct
watch
*
w
;
struct
format
*
f
;
...
...
@@ -530,15 +530,13 @@ addf_vcl_log(const char *key, const char *str)
AN
(
f
);
f
->
func
=
&
format_fragment
;
f
->
frag
=
&
w
->
frag
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
str
);
f
->
string
=
strdup
(
""
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
static
void
addf_hdr
(
struct
watch_head
*
head
,
const
char
*
key
,
const
char
*
str
)
addf_hdr
(
struct
watch_head
*
head
,
const
char
*
key
)
{
struct
watch
*
w
;
struct
format
*
f
;
...
...
@@ -547,19 +545,16 @@ addf_hdr(struct watch_head *head, const char *key, const char *str)
AN
(
key
);
ALLOC_OBJ
(
w
,
WATCH_MAGIC
);
AN
(
w
);
w
->
key
=
strdup
(
key
);
AN
(
w
->
key
);
w
->
keylen
=
strlen
(
w
->
key
);
w
->
keylen
=
asprintf
(
&
w
->
key
,
"%s:"
,
key
);
assert
(
w
->
keylen
>
0
);
VTAILQ_INSERT_TAIL
(
head
,
w
,
list
);
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
AN
(
f
);
f
->
func
=
&
format_fragment
;
f
->
frag
=
&
w
->
frag
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
str
);
f
->
string
=
strdup
(
"-"
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
...
...
@@ -573,27 +568,24 @@ addf_vsl(enum VSL_tag_e tag, long i, const char *prefix)
w
->
tag
=
tag
;
assert
(
i
<=
INT_MAX
);
w
->
idx
=
i
;
if
(
prefix
)
{
if
(
prefix
!=
NULL
)
{
w
->
prefixlen
=
asprintf
(
&
w
->
prefix
,
"%s:"
,
prefix
);
assert
(
w
->
prefixlen
>
0
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
watch_vsl
,
w
,
list
);
addf_fragment
(
&
w
->
frag
,
"-"
);
}
static
void
addf_auth
(
const
char
*
str
)
addf_auth
(
void
)
{
struct
format
*
f
;
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
AN
(
f
);
f
->
func
=
&
format_auth
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
str
);
f
->
string
=
strdup
(
"-"
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
...
...
@@ -625,7 +617,7 @@ parse_x_format(char *buf)
return
;
}
if
(
!
strncmp
(
buf
,
"VCL_Log:"
,
8
))
{
addf_vcl_log
(
buf
+
8
,
""
);
addf_vcl_log
(
buf
+
8
);
return
;
}
if
(
!
strncmp
(
buf
,
"VSL:"
,
4
))
{
...
...
@@ -758,7 +750,7 @@ parse_format(const char *format)
addf_time
(
*
p
,
NULL
);
break
;
case
'u'
:
/* Remote user from auth */
addf_auth
(
"-"
);
addf_auth
();
break
;
case
'U'
:
/* URL */
addf_fragment
(
&
CTX
.
frag
[
F_U
],
"-"
);
...
...
@@ -777,12 +769,10 @@ parse_format(const char *format)
q
++
;
switch
(
*
q
)
{
case
'i'
:
strcat
(
buf
,
":"
);
addf_hdr
(
&
CTX
.
watch_reqhdr
,
buf
,
"-"
);
addf_hdr
(
&
CTX
.
watch_reqhdr
,
buf
);
break
;
case
'o'
:
strcat
(
buf
,
":"
);
addf_hdr
(
&
CTX
.
watch_resphdr
,
buf
,
"-"
);
addf_hdr
(
&
CTX
.
watch_resphdr
,
buf
);
break
;
case
't'
:
addf_time
(
*
q
,
buf
);
...
...
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