[master] 9fa4d02 Add varnishtest support for OOB urgent messages and a test case execising that
Martin Blix Grydeland
martin at varnish-software.com
Fri Apr 10 14:06:55 CEST 2015
commit 9fa4d02542fcb40b2154d382d397d75a8cefbeb3
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Fri Apr 10 14:02:15 2015 +0200
Add varnishtest support for OOB urgent messages and a test case
execising that
diff --git a/bin/varnishtest/tests/b00046.vtc b/bin/varnishtest/tests/b00046.vtc
new file mode 100644
index 0000000..95d64bb
--- /dev/null
+++ b/bin/varnishtest/tests/b00046.vtc
@@ -0,0 +1,33 @@
+varnishtest "Check that TCP OOB urgent data doesn't cause ill effects"
+
+server s1 {
+ rxreq
+ send_urgent " "
+ txresp
+ send_urgent " "
+
+ rxreq
+ send_urgent " "
+ txresp
+ send_urgent " "
+} -start
+
+varnish v1 -vcl+backend {} -start
+
+client c1 {
+ delay 0.5
+ send_urgent " "
+ expect_close
+} -run
+
+client c1 {
+ send_urgent " "
+ txreq -url /1
+ send_urgent " "
+ rxresp
+ send_urgent " "
+ txreq -url /2
+ send_urgent " "
+ rxresp
+ send_urgent " "
+} -run
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 2cd7ad7..93ddf4e 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1026,6 +1026,28 @@ cmd_http_send_n(CMD_ARGS)
}
/**********************************************************************
+ * Send an OOB urgent message
+ */
+
+static void
+cmd_http_send_urgent(CMD_ARGS)
+{
+ struct http *hp;
+ int i;
+
+ (void)cmd;
+ (void)vl;
+ CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
+ AN(av[1]);
+ AZ(av[2]);
+ vtc_dump(hp->vl, 4, "send_urgent", av[1], -1);
+ i = send(hp->fd, av[1], strlen(av[1]), MSG_OOB);
+ if (i != strlen(av[1]))
+ vtc_log(hp->vl, hp->fatal,
+ "Write error in http_send_urgent(): %s", strerror(errno));
+}
+
+/**********************************************************************
* Send a hex string
*/
@@ -1290,6 +1312,7 @@ static const struct cmds http_cmds[] = {
{ "expect", cmd_http_expect },
{ "send", cmd_http_send },
{ "send_n", cmd_http_send_n },
+ { "send_urgent", cmd_http_send_urgent },
{ "sendhex", cmd_http_sendhex },
{ "chunked", cmd_http_chunked },
{ "chunkedlen", cmd_http_chunkedlen },
More information about the varnish-commit
mailing list