[master] acf8703 Add a facility for sending a string a number of times.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Mar 10 20:29:17 CET 2015
commit acf8703d8d7e12c359aacb7b27fb1cf84f4bc43a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 10 19:28:54 2015 +0000
Add a facility for sending a string a number of times.
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 68aacde..db0d265 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -997,6 +997,34 @@ cmd_http_send(CMD_ARGS)
}
/**********************************************************************
+ * Send a string many times
+ */
+
+static void
+cmd_http_send_n(CMD_ARGS)
+{
+ struct http *hp;
+ int i, n, l;
+
+ (void)cmd;
+ (void)vl;
+ CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
+ AN(av[1]);
+ AN(av[2]);
+ AZ(av[3]);
+ n = strtoul(av[1], NULL, 0);
+ vtc_dump(hp->vl, 4, "send_n", av[2], -1);
+ l = strlen(av[2]);
+ while (n--) {
+ i = write(hp->fd, av[2], l);
+ if (i != l)
+ vtc_log(hp->vl, hp->fatal,
+ "Write error in http_send(): %s",
+ strerror(errno));
+ }
+}
+
+/**********************************************************************
* Send a hex string
*/
@@ -1260,6 +1288,7 @@ static const struct cmds http_cmds[] = {
{ "gunzip", cmd_http_gunzip_body },
{ "expect", cmd_http_expect },
{ "send", cmd_http_send },
+ { "send_n", cmd_http_send_n },
{ "sendhex", cmd_http_sendhex },
{ "chunked", cmd_http_chunked },
{ "chunkedlen", cmd_http_chunkedlen },
More information about the varnish-commit
mailing list