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
7fa72283
Commit
7fa72283
authored
May 09, 2023
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collect all the body-gzip stuff one place.
parent
9f48ee00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
42 deletions
+43
-42
vtc.h
bin/varnishtest/vtc.h
+1
-1
vtc_gzip.c
bin/varnishtest/vtc_gzip.c
+25
-10
vtc_http.c
bin/varnishtest/vtc_http.c
+7
-20
vtc_http2.c
bin/varnishtest/vtc_http2.c
+10
-11
No files found.
bin/varnishtest/vtc.h
View file @
7fa72283
...
...
@@ -151,7 +151,7 @@ void b64_settings(const struct http *hp, const char *s);
/* vtc_gzip.c */
void
vtc_gunzip
(
struct
http
*
,
char
*
,
long
*
);
void
vtc_gzip_cmd
(
struct
http
*
hp
,
char
*
const
*
argv
,
char
**
body
,
long
*
bodylen
);
int
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 @
7fa72283
...
...
@@ -194,26 +194,41 @@ vtc_gunzip(struct http *hp, char *body, long *bodylen)
bprintf
(
hp
->
bodylen
,
"%ld"
,
*
bodylen
);
}
void
vtc_gzip_cmd
(
struct
http
*
hp
,
char
*
const
*
a
rg
v
,
char
**
body
,
long
*
bodylen
)
int
vtc_gzip_cmd
(
struct
http
*
hp
,
char
*
const
*
av
,
char
**
body
,
long
*
bodylen
)
{
char
*
b
;
AN
(
hp
);
AN
(
a
rg
v
);
AN
(
av
);
AN
(
body
);
AN
(
bodylen
);
if
(
!
strcmp
(
*
argv
,
"-gzipbody"
))
{
AZ
(
*
body
);
vtc_gzip
(
hp
,
argv
[
1
],
body
,
bodylen
);
if
(
!
strcmp
(
*
av
,
"-gzipresidual"
))
{
hp
->
gzipresidual
=
strtoul
(
av
[
1
],
NULL
,
0
);
return
(
1
);
}
if
(
!
strcmp
(
*
av
,
"-gziplevel"
))
{
hp
->
gziplevel
=
strtoul
(
av
[
1
],
NULL
,
0
);
return
(
1
);
}
if
(
!
strcmp
(
*
av
,
"-gzipbody"
))
{
if
(
*
body
!=
NULL
)
free
(
*
body
);
*
body
=
NULL
;
vtc_gzip
(
hp
,
av
[
1
],
body
,
bodylen
);
AN
(
*
body
);
}
else
if
(
!
strcmp
(
*
argv
,
"-gziplen"
))
{
b
=
synth_body
(
argv
[
1
],
1
);
return
(
2
);
}
if
(
!
strcmp
(
*
av
,
"-gziplen"
))
{
if
(
*
body
!=
NULL
)
free
(
*
body
);
*
body
=
NULL
;
b
=
synth_body
(
av
[
1
],
1
);
vtc_gzip
(
hp
,
b
,
body
,
bodylen
);
AN
(
*
body
);
free
(
b
);
}
else
{
WRONG
(
"Wrong cmd til vtc_gzip_cmd"
);
return
(
2
);
}
return
(
0
);
}
bin/varnishtest/vtc_http.c
View file @
7fa72283
...
...
@@ -839,26 +839,13 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
body
=
synth_body
(
av
[
1
],
0
);
bodylen
=
strlen
(
body
);
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gzipresidual"
))
{
hp
->
gzipresidual
=
strtoul
(
av
[
1
],
NULL
,
0
);
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gziplevel"
))
{
hp
->
gziplevel
=
strtoul
(
av
[
1
],
NULL
,
0
);
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gziplen"
))
{
assert
(
body
==
nullbody
);
free
(
body
);
body
=
NULL
;
vtc_gzip_cmd
(
hp
,
av
,
&
body
,
&
bodylen
);
VSB_printf
(
hp
->
vsb
,
"Content-Encoding: gzip%s"
,
nl
);
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gzipbody"
))
{
assert
(
body
==
nullbody
);
free
(
body
);
body
=
NULL
;
vtc_gzip_cmd
(
hp
,
av
,
&
body
,
&
bodylen
);
VSB_printf
(
hp
->
vsb
,
"Content-Encoding: gzip%s"
,
nl
);
av
++
;
}
else
if
(
!
strncmp
(
*
av
,
"-gzip"
,
5
))
{
l
=
vtc_gzip_cmd
(
hp
,
av
,
&
body
,
&
bodylen
);
if
(
l
==
0
)
break
;
av
+=
l
;
if
(
l
>
1
)
VSB_printf
(
hp
->
vsb
,
"Content-Encoding: gzip%s"
,
nl
);
}
else
break
;
}
...
...
bin/varnishtest/vtc_http2.c
View file @
7fa72283
...
...
@@ -1427,6 +1427,7 @@ static void
cmd_tx11obj
(
CMD_ARGS
)
{
struct
stream
*
s
;
int
i
;
int
status_done
=
1
;
int
method_done
=
1
;
int
path_done
=
1
;
...
...
@@ -1597,17 +1598,15 @@ cmd_tx11obj(CMD_ARGS)
f
.
flags
&=
~
END_STREAM
;
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gzipbody"
))
{
vtc_gzip_cmd
(
s
->
hp
,
av
,
&
body
,
&
bodylen
);
ENC
(
hdr
,
":content-encoding"
,
"gzip"
);
f
.
flags
&=
~
END_STREAM
;
av
++
;
}
else
if
(
!
strcmp
(
*
av
,
"-gziplen"
))
{
vtc_gzip_cmd
(
s
->
hp
,
av
,
&
body
,
&
bodylen
);
ENC
(
hdr
,
":content-encoding"
,
"gzip"
);
f
.
flags
&=
~
END_STREAM
;
av
++
;
else
if
(
!
strncmp
(
*
av
,
"-gzip"
,
5
))
{
i
=
vtc_gzip_cmd
(
s
->
hp
,
av
,
&
body
,
&
bodylen
);
if
(
i
==
0
)
break
;
av
+=
i
;
if
(
i
>
1
)
{
ENC
(
hdr
,
":content-encoding"
,
"gzip"
);
f
.
flags
&=
~
END_STREAM
;
}
}
else
if
(
AV_IS
(
"-dep"
))
{
STRTOU32_CHECK
(
stid
,
av
,
p
,
vl
,
"-dep"
,
0
);
...
...
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