Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
968d11d1
Commit
968d11d1
authored
Oct 11, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to use regexp's for expect in HTTP.
parent
9f1cdbee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
vtc_http.c
bin/varnishtest/vtc_http.c
+18
-0
No files found.
bin/varnishtest/vtc_http.c
View file @
968d11d1
...
...
@@ -40,6 +40,7 @@
#include "vct.h"
#include "vgz.h"
#include "vre.h"
#include "vtcp.h"
#define MAX_HDR 50
...
...
@@ -213,6 +214,10 @@ cmd_http_expect(CMD_ARGS)
const
char
*
lhs
;
char
*
cmp
;
const
char
*
rhs
;
vre_t
*
vre
;
const
char
*
error
;
int
erroroffset
;
int
i
;
(
void
)
cmd
;
(
void
)
vl
;
...
...
@@ -241,6 +246,19 @@ cmd_http_expect(CMD_ARGS)
else
vtc_log
(
hp
->
vl
,
4
,
"EXPECT %s (%s) %s %s (%s) match"
,
av
[
0
],
lhs
,
av
[
1
],
av
[
2
],
rhs
);
}
else
if
(
!
strcmp
(
cmp
,
"~"
)
||
!
strcmp
(
cmp
,
"!~"
))
{
vre
=
VRE_compile
(
rhs
,
0
,
&
error
,
&
erroroffset
);
if
(
vre
==
NULL
)
vtc_log
(
hp
->
vl
,
0
,
"REGEXP error: %s (@%d) (%s)"
,
error
,
erroroffset
,
rhs
);
i
=
VRE_exec
(
vre
,
lhs
,
strlen
(
lhs
),
0
,
0
,
NULL
,
0
,
0
);
if
((
i
>=
0
&&
*
cmp
==
'~'
)
||
(
i
<
0
&&
*
cmp
==
'!'
))
vtc_log
(
hp
->
vl
,
4
,
"EXPECT %s (%s) %s
\"
%s
\"
match"
,
av
[
0
],
lhs
,
cmp
,
rhs
);
else
vtc_log
(
hp
->
vl
,
0
,
"EXPECT %s (%s) %s
\"
%s
\"
failed"
,
av
[
0
],
lhs
,
cmp
,
rhs
);
VRE_free
(
&
vre
);
}
else
{
vtc_log
(
hp
->
vl
,
0
,
"EXPECT %s (%s) %s %s (%s) test not implemented"
,
...
...
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