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
bbc31a5e
Commit
bbc31a5e
authored
Dec 31, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vep: Extract src attr parsing to its own function
parent
a810eb84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
23 deletions
+34
-23
cache_esi_parse.c
bin/varnishd/cache/cache_esi_parse.c
+34
-23
No files found.
bin/varnishd/cache/cache_esi_parse.c
View file @
bbc31a5e
...
...
@@ -429,6 +429,37 @@ vep_do_remove(struct vep_state *vep, enum dowhat what)
/*---------------------------------------------------------------------
*/
static
void
include_attr_src
(
struct
vep_state
*
vep
)
{
const
char
*
p
;
if
(
vep
->
include_src
!=
NULL
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> "
"has multiple src= attributes"
);
vep
->
state
=
VEP_TAGERROR
;
VSB_destroy
(
&
vep
->
attr_vsb
);
VSB_destroy
(
&
vep
->
include_src
);
return
;
}
for
(
p
=
VSB_data
(
vep
->
attr_vsb
);
*
p
!=
'\0'
;
p
++
)
if
(
vct_islws
(
*
p
))
break
;
if
(
*
p
!=
'\0'
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> "
"has whitespace in src= attribute"
);
vep
->
state
=
VEP_TAGERROR
;
VSB_destroy
(
&
vep
->
attr_vsb
);
if
(
vep
->
include_src
!=
NULL
)
VSB_destroy
(
&
vep
->
include_src
);
return
;
}
vep
->
include_src
=
vep
->
attr_vsb
;
vep
->
attr_vsb
=
NULL
;
}
static
void
v_matchproto_
()
vep_do_include
(
struct
vep_state
*
vep
,
enum
dowhat
what
)
{
...
...
@@ -439,31 +470,11 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
if
(
what
==
DO_ATTR
)
{
Debug
(
"ATTR (%s) (%s)
\n
"
,
vep
->
match_hit
->
match
,
VSB_data
(
vep
->
attr_vsb
));
if
(
vep
->
include_src
!=
NULL
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> "
"has multiple src= attributes"
);
vep
->
state
=
VEP_TAGERROR
;
VSB_destroy
(
&
vep
->
attr_vsb
);
VSB_destroy
(
&
vep
->
include_src
);
if
(
!
strcmp
(
"src="
,
vep
->
match_hit
->
match
))
{
include_attr_src
(
vep
);
return
;
}
for
(
p
=
VSB_data
(
vep
->
attr_vsb
);
*
p
!=
'\0'
;
p
++
)
if
(
vct_islws
(
*
p
))
break
;
if
(
*
p
!=
'\0'
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> "
"has whitespace in src= attribute"
);
vep
->
state
=
VEP_TAGERROR
;
VSB_destroy
(
&
vep
->
attr_vsb
);
if
(
vep
->
include_src
!=
NULL
)
VSB_destroy
(
&
vep
->
include_src
);
return
;
}
vep
->
include_src
=
vep
->
attr_vsb
;
vep
->
attr_vsb
=
NULL
;
return
;
WRONG
(
"Unhandled <esi:include> attribute"
);
}
assert
(
what
==
DO_TAG
);
if
(
!
vep
->
emptytag
)
...
...
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