[master] 414d9f7 Add "-hdrlen <header> <length>"

Poul-Henning Kamp phk at FreeBSD.org
Tue Mar 7 11:37:05 CET 2017


commit 414d9f7ffaff480592d99e3ba385674c2bb1877f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 7 10:32:55 2017 +0000

    Add "-hdrlen <header> <length>"

diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index b81bb70..4df6dd2 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -872,6 +872,7 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
 	char *b, *c;
 	char *nullbody = NULL;
 	int nolen = 0;
+	int l;
 
 	(void)vl;
 	nullbody = body;
@@ -882,6 +883,13 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
 		} else if (!strcmp(*av, "-hdr")) {
 			VSB_printf(hp->vsb, "%s%s", av[1], nl);
 			av++;
+		} else if (!strcmp(*av, "-hdrlen")) {
+			VSB_printf(hp->vsb, "%s: ", av[1]);
+			l = atoi(av[2]);
+			while (l-- > 0)
+				VSB_putc(hp->vsb, '0' + (l % 10));
+			VSB_printf(hp->vsb, "%s", nl);
+			av+=2;
 		} else
 			break;
 	}
@@ -977,6 +985,9 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
  *                 Add STRING as a header, it must follow this format:
  *                 "name: value". It can be called multiple times.
  *
+ *         \-hdrlen STRING NUMBER
+ *                 Add STRING as a header with NUMBER bytes of content.
+ *
  *         You can then use the arguments related to the body:
  *
  *         \-body STRING



More information about the varnish-commit mailing list