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
38415a2a
Commit
38415a2a
authored
Aug 17, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "sendhex" verb
parent
81010e41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
4 deletions
+48
-4
vtc_http.c
bin/varnishtest/vtc_http.c
+42
-0
vtc_log.c
bin/varnishtest/vtc_log.c
+6
-4
No files found.
bin/varnishtest/vtc_http.c
View file @
38415a2a
...
...
@@ -903,6 +903,47 @@ cmd_http_send(CMD_ARGS)
}
/**********************************************************************
* Send a hex string
*/
static
void
cmd_http_sendhex
(
CMD_ARGS
)
{
struct
http
*
hp
;
char
buf
[
3
],
*
q
;
uint8_t
*
p
;
int
i
,
j
,
l
;
(
void
)
cmd
;
(
void
)
vl
;
CAST_OBJ_NOTNULL
(
hp
,
priv
,
HTTP_MAGIC
);
AN
(
av
[
1
]);
AZ
(
av
[
2
]);
l
=
strlen
(
av
[
1
])
/
2
;
p
=
malloc
(
l
);
AN
(
p
);
q
=
av
[
1
];
for
(
i
=
0
;
i
<
l
;
i
++
)
{
while
(
vct_issp
(
*
q
))
q
++
;
if
(
*
q
==
'\0'
)
break
;
memcpy
(
buf
,
q
,
2
);
q
+=
2
;
buf
[
2
]
=
'\0'
;
if
(
!
vct_ishex
(
buf
[
0
])
||
!
vct_ishex
(
buf
[
1
]))
vtc_log
(
hp
->
vl
,
0
,
"Illegal Hex char
\"
%c%c
\"
"
,
buf
[
0
],
buf
[
1
]);
p
[
i
]
=
strtoul
(
buf
,
NULL
,
16
);
}
vtc_hexdump
(
hp
->
vl
,
4
,
"sendhex"
,
(
void
*
)
p
,
i
);
j
=
write
(
hp
->
fd
,
p
,
i
);
assert
(
j
==
i
);
free
(
p
);
}
/**********************************************************************
* Send a string as chunked encoding
*/
...
...
@@ -1080,6 +1121,7 @@ static const struct cmds http_cmds[] = {
{
"gunzip"
,
cmd_http_gunzip_body
},
{
"expect"
,
cmd_http_expect
},
{
"send"
,
cmd_http_send
},
{
"sendhex"
,
cmd_http_sendhex
},
{
"chunked"
,
cmd_http_chunked
},
{
"chunkedlen"
,
cmd_http_chunkedlen
},
{
"delay"
,
cmd_delay
},
...
...
bin/varnishtest/vtc_log.c
View file @
38415a2a
...
...
@@ -227,8 +227,10 @@ vtc_hexdump(struct vtclog *vl, unsigned lvl, const char *pfx, const unsigned cha
{
int
nl
=
1
;
unsigned
l
;
double
tx
;
CHECK_OBJ_NOTNULL
(
vl
,
VTCLOG_MAGIC
);
tx
=
TIM_mono
()
-
t0
;
assert
(
len
>=
0
);
assert
(
lvl
<
NLEAD
);
AZ
(
pthread_mutex_lock
(
&
vl
->
mtx
));
...
...
@@ -236,8 +238,8 @@ vtc_hexdump(struct vtclog *vl, unsigned lvl, const char *pfx, const unsigned cha
if
(
pfx
==
NULL
)
pfx
=
""
;
if
(
str
==
NULL
)
VSB_printf
(
vl
->
vsb
,
"%s %-4s %
s(null)
\n
"
,
lead
[
lvl
],
vl
->
id
,
pfx
);
VSB_printf
(
vl
->
vsb
,
"%s %-4s %
4.1f %s| (null)
"
,
lead
[
lvl
],
vl
->
id
,
tx
,
pfx
);
else
{
for
(
l
=
0
;
l
<
len
;
l
++
,
str
++
)
{
if
(
l
>
512
)
{
...
...
@@ -245,8 +247,8 @@ vtc_hexdump(struct vtclog *vl, unsigned lvl, const char *pfx, const unsigned cha
break
;
}
if
(
nl
)
{
VSB_printf
(
vl
->
vsb
,
"%s %-4s %s| "
,
lead
[
lvl
],
vl
->
id
,
pfx
);
VSB_printf
(
vl
->
vsb
,
"%s %-4s %
4.1f %
s| "
,
lead
[
lvl
],
vl
->
id
,
tx
,
pfx
);
nl
=
0
;
}
VSB_printf
(
vl
->
vsb
,
" %02x"
,
*
str
);
...
...
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