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
Hide 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
...
@@ -393,7 +393,7 @@ format_auth(const struct format *format)
...
@@ -393,7 +393,7 @@ format_auth(const struct format *format)
if
(
CTX
.
frag
[
F_auth
].
gen
!=
CTX
.
gen
||
if
(
CTX
.
frag
[
F_auth
].
gen
!=
CTX
.
gen
||
VB64_decode
(
buf
,
sizeof
buf
,
CTX
.
frag
[
F_auth
].
b
,
VB64_decode
(
buf
,
sizeof
buf
,
CTX
.
frag
[
F_auth
].
b
,
CTX
.
frag
[
F_auth
].
e
))
{
CTX
.
frag
[
F_auth
].
e
))
{
if
(
format
->
string
==
NULL
)
if
(
format
->
string
==
NULL
)
return
(
-
1
);
return
(
-
1
);
AZ
(
vsb_esc_cat
(
CTX
.
vsb
,
format
->
string
,
AZ
(
vsb_esc_cat
(
CTX
.
vsb
,
format
->
string
,
...
@@ -514,7 +514,7 @@ addf_requestline(void)
...
@@ -514,7 +514,7 @@ addf_requestline(void)
}
}
static
void
static
void
addf_vcl_log
(
const
char
*
key
,
const
char
*
str
)
addf_vcl_log
(
const
char
*
key
)
{
{
struct
watch
*
w
;
struct
watch
*
w
;
struct
format
*
f
;
struct
format
*
f
;
...
@@ -530,15 +530,13 @@ addf_vcl_log(const char *key, const char *str)
...
@@ -530,15 +530,13 @@ addf_vcl_log(const char *key, const char *str)
AN
(
f
);
AN
(
f
);
f
->
func
=
&
format_fragment
;
f
->
func
=
&
format_fragment
;
f
->
frag
=
&
w
->
frag
;
f
->
frag
=
&
w
->
frag
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
""
);
f
->
string
=
strdup
(
str
);
AN
(
f
->
string
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
}
static
void
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
watch
*
w
;
struct
format
*
f
;
struct
format
*
f
;
...
@@ -547,19 +545,16 @@ addf_hdr(struct watch_head *head, const char *key, const char *str)
...
@@ -547,19 +545,16 @@ addf_hdr(struct watch_head *head, const char *key, const char *str)
AN
(
key
);
AN
(
key
);
ALLOC_OBJ
(
w
,
WATCH_MAGIC
);
ALLOC_OBJ
(
w
,
WATCH_MAGIC
);
AN
(
w
);
AN
(
w
);
w
->
key
=
strdup
(
key
);
w
->
keylen
=
asprintf
(
&
w
->
key
,
"%s:"
,
key
);
AN
(
w
->
key
);
assert
(
w
->
keylen
>
0
);
w
->
keylen
=
strlen
(
w
->
key
);
VTAILQ_INSERT_TAIL
(
head
,
w
,
list
);
VTAILQ_INSERT_TAIL
(
head
,
w
,
list
);
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
AN
(
f
);
AN
(
f
);
f
->
func
=
&
format_fragment
;
f
->
func
=
&
format_fragment
;
f
->
frag
=
&
w
->
frag
;
f
->
frag
=
&
w
->
frag
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
"-"
);
f
->
string
=
strdup
(
str
);
AN
(
f
->
string
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
}
...
@@ -573,27 +568,24 @@ addf_vsl(enum VSL_tag_e tag, long i, const char *prefix)
...
@@ -573,27 +568,24 @@ addf_vsl(enum VSL_tag_e tag, long i, const char *prefix)
w
->
tag
=
tag
;
w
->
tag
=
tag
;
assert
(
i
<=
INT_MAX
);
assert
(
i
<=
INT_MAX
);
w
->
idx
=
i
;
w
->
idx
=
i
;
if
(
prefix
)
{
if
(
prefix
!=
NULL
)
{
w
->
prefixlen
=
asprintf
(
&
w
->
prefix
,
"%s:"
,
prefix
);
w
->
prefixlen
=
asprintf
(
&
w
->
prefix
,
"%s:"
,
prefix
);
assert
(
w
->
prefixlen
>
0
);
assert
(
w
->
prefixlen
>
0
);
}
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
watch_vsl
,
w
,
list
);
VTAILQ_INSERT_TAIL
(
&
CTX
.
watch_vsl
,
w
,
list
);
addf_fragment
(
&
w
->
frag
,
"-"
);
addf_fragment
(
&
w
->
frag
,
"-"
);
}
}
static
void
static
void
addf_auth
(
const
char
*
str
)
addf_auth
(
void
)
{
{
struct
format
*
f
;
struct
format
*
f
;
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
ALLOC_OBJ
(
f
,
FORMAT_MAGIC
);
AN
(
f
);
AN
(
f
);
f
->
func
=
&
format_auth
;
f
->
func
=
&
format_auth
;
if
(
str
!=
NULL
)
{
f
->
string
=
strdup
(
"-"
);
f
->
string
=
strdup
(
str
);
AN
(
f
->
string
);
AN
(
f
->
string
);
}
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
VTAILQ_INSERT_TAIL
(
&
CTX
.
format
,
f
,
list
);
}
}
...
@@ -625,7 +617,7 @@ parse_x_format(char *buf)
...
@@ -625,7 +617,7 @@ parse_x_format(char *buf)
return
;
return
;
}
}
if
(
!
strncmp
(
buf
,
"VCL_Log:"
,
8
))
{
if
(
!
strncmp
(
buf
,
"VCL_Log:"
,
8
))
{
addf_vcl_log
(
buf
+
8
,
""
);
addf_vcl_log
(
buf
+
8
);
return
;
return
;
}
}
if
(
!
strncmp
(
buf
,
"VSL:"
,
4
))
{
if
(
!
strncmp
(
buf
,
"VSL:"
,
4
))
{
...
@@ -758,7 +750,7 @@ parse_format(const char *format)
...
@@ -758,7 +750,7 @@ parse_format(const char *format)
addf_time
(
*
p
,
NULL
);
addf_time
(
*
p
,
NULL
);
break
;
break
;
case
'u'
:
/* Remote user from auth */
case
'u'
:
/* Remote user from auth */
addf_auth
(
"-"
);
addf_auth
();
break
;
break
;
case
'U'
:
/* URL */
case
'U'
:
/* URL */
addf_fragment
(
&
CTX
.
frag
[
F_U
],
"-"
);
addf_fragment
(
&
CTX
.
frag
[
F_U
],
"-"
);
...
@@ -777,12 +769,10 @@ parse_format(const char *format)
...
@@ -777,12 +769,10 @@ parse_format(const char *format)
q
++
;
q
++
;
switch
(
*
q
)
{
switch
(
*
q
)
{
case
'i'
:
case
'i'
:
strcat
(
buf
,
":"
);
addf_hdr
(
&
CTX
.
watch_reqhdr
,
buf
);
addf_hdr
(
&
CTX
.
watch_reqhdr
,
buf
,
"-"
);
break
;
break
;
case
'o'
:
case
'o'
:
strcat
(
buf
,
":"
);
addf_hdr
(
&
CTX
.
watch_resphdr
,
buf
);
addf_hdr
(
&
CTX
.
watch_resphdr
,
buf
,
"-"
);
break
;
break
;
case
't'
:
case
't'
:
addf_time
(
*
q
,
buf
);
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