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
9f48ee00
Commit
9f48ee00
authored
May 09, 2023
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the -gzipbody and -gziplen arguments centrally.
parent
f6ef5927
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
vtc.h
bin/varnishtest/vtc.h
+1
-1
vtc_gzip.c
bin/varnishtest/vtc_gzip.c
+25
-1
vtc_http.c
bin/varnishtest/vtc_http.c
+4
-6
vtc_http2.c
bin/varnishtest/vtc_http2.c
+3
-9
No files found.
bin/varnishtest/vtc.h
View file @
9f48ee00
...
...
@@ -150,8 +150,8 @@ void stop_h2(struct http *hp);
void
b64_settings
(
const
struct
http
*
hp
,
const
char
*
s
);
/* vtc_gzip.c */
void
vtc_gzip
(
struct
http
*
,
const
char
*
,
char
**
,
long
*
);
void
vtc_gunzip
(
struct
http
*
,
char
*
,
long
*
);
void
vtc_gzip_cmd
(
struct
http
*
hp
,
char
*
const
*
argv
,
char
**
body
,
long
*
bodylen
);
/* vtc_subr.c */
struct
vsb
*
vtc_hex_to_bin
(
struct
vtclog
*
vl
,
const
char
*
arg
);
...
...
bin/varnishtest/vtc_gzip.c
View file @
9f48ee00
...
...
@@ -103,7 +103,7 @@ vtc_gzip_vsb(struct vtclog *vl, int fatal, int gzip_level, const struct vsb *vin
return
(
vout
);
}
void
static
void
vtc_gzip
(
struct
http
*
hp
,
const
char
*
input
,
char
**
body
,
long
*
bodylen
)
{
struct
vsb
*
vin
,
*
vout
;
...
...
@@ -193,3 +193,27 @@ vtc_gunzip(struct http *hp, char *body, long *bodylen)
vtc_dump
(
hp
->
vl
,
4
,
"body"
,
body
,
*
bodylen
);
bprintf
(
hp
->
bodylen
,
"%ld"
,
*
bodylen
);
}
void
vtc_gzip_cmd
(
struct
http
*
hp
,
char
*
const
*
argv
,
char
**
body
,
long
*
bodylen
)
{
char
*
b
;
AN
(
hp
);
AN
(
argv
);
AN
(
body
);
AN
(
bodylen
);
if
(
!
strcmp
(
*
argv
,
"-gzipbody"
))
{
AZ
(
*
body
);
vtc_gzip
(
hp
,
argv
[
1
],
body
,
bodylen
);
AN
(
*
body
);
}
else
if
(
!
strcmp
(
*
argv
,
"-gziplen"
))
{
b
=
synth_body
(
argv
[
1
],
1
);
vtc_gzip
(
hp
,
b
,
body
,
bodylen
);
AN
(
*
body
);
free
(
b
);
}
else
{
WRONG
(
"Wrong cmd til vtc_gzip_cmd"
);
}
}
bin/varnishtest/vtc_http.c
View file @
9f48ee00
...
...
@@ -848,18 +848,16 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
}
else
if
(
!
strcmp
(
*
av
,
"-gziplen"
))
{
assert
(
body
==
nullbody
);
free
(
body
);
b
=
synth_body
(
av
[
1
],
1
);
vtc_gzip
(
hp
,
b
,
&
body
,
&
bodylen
);
free
(
b
);
body
=
NULL
;
vtc_gzip_cmd
(
hp
,
av
,
&
body
,
&
bodylen
);
VSB_printf
(
hp
->
vsb
,
"Content-Encoding: gzip%s"
,
nl
);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gzipbody"
))
{
assert
(
body
==
nullbody
);
free
(
body
);
vtc_gzip
(
hp
,
av
[
1
],
&
body
,
&
bodylen
);
body
=
NULL
;
vtc_gzip_cmd
(
hp
,
av
,
&
body
,
&
bodylen
);
VSB_printf
(
hp
->
vsb
,
"Content-Encoding: gzip%s"
,
nl
);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
av
++
;
}
else
break
;
...
...
bin/varnishtest/vtc_http2.c
View file @
9f48ee00
...
...
@@ -1443,7 +1443,7 @@ cmd_tx11obj(CMD_ARGS)
/*XXX: do we need a better api? yes we do */
struct
hpk_hdr
hdr
;
char
*
cmd_str
=
*
av
;
char
*
b
,
*
p
;
char
*
p
;
CAST_OBJ_NOTNULL
(
s
,
priv
,
STREAM_MAGIC
);
INIT_FRAME
(
f
,
CONTINUATION
,
0
,
s
->
id
,
END_HEADERS
);
...
...
@@ -1598,19 +1598,13 @@ cmd_tx11obj(CMD_ARGS)
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gzipbody"
))
{
AZ
(
body
);
vtc_gzip
(
s
->
hp
,
av
[
1
],
&
body
,
&
bodylen
);
AN
(
body
);
vtc_gzip_cmd
(
s
->
hp
,
av
,
&
body
,
&
bodylen
);
ENC
(
hdr
,
":content-encoding"
,
"gzip"
);
f
.
flags
&=
~
END_STREAM
;
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gziplen"
))
{
AZ
(
body
);
b
=
synth_body
(
av
[
1
],
1
);
vtc_gzip
(
s
->
hp
,
b
,
&
body
,
&
bodylen
);
AN
(
body
);
free
(
b
);
vtc_gzip_cmd
(
s
->
hp
,
av
,
&
body
,
&
bodylen
);
ENC
(
hdr
,
":content-encoding"
,
"gzip"
);
f
.
flags
&=
~
END_STREAM
;
av
++
;
...
...
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