[master] 6996fab Make it possible to tweak the gzip compressoin level
Poul-Henning Kamp
phk at project.varnish-software.com
Sat Jan 22 21:08:43 CET 2011
commit 6996fab96f1207129ef43c338703d027116f900b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Jan 22 20:08:28 2011 +0000
Make it possible to tweak the gzip compressoin level
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 9c9609d..00a8a71 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -72,6 +72,8 @@ struct http {
char *req[MAX_HDR];
char *resp[MAX_HDR];
+
+ int gzip_level;
};
#define ONLY_CLIENT(hp, av) \
@@ -590,7 +592,7 @@ gzip_body(struct http *hp, const char *txt, char **body, int *bodylen)
vz.avail_out = l + OVERHEAD;
assert(Z_OK == deflateInit2(&vz,
- Z_NO_COMPRESSION, Z_DEFLATED, 31, 9, Z_DEFAULT_STRATEGY));
+ hp->gziplevel, Z_DEFLATED, 31, 9, Z_DEFAULT_STRATEGY));
assert(Z_STREAM_END == deflate(&vz, Z_FINISH));
*bodylen = vz.total_out;
vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju",
@@ -681,6 +683,9 @@ cmd_http_txresp(CMD_ARGS)
body = synth_body(av[1], 0);
bodylen = strlen(body);
av++;
+ } else if (!strcmp(*av, "-gziplevel")) {
+ hp->gzip_level = strtoul(av[1], NULL, 0);
+ av++;
} else if (!strcmp(*av, "-gziplen")) {
assert(body == nullbody);
b = synth_body(av[1], 1);
More information about the varnish-commit
mailing list