[master] c957ad878 Add -method for consistency

Federico G. Schwindt fgsch at lodoss.net
Sat Apr 27 21:57:12 UTC 2019


commit c957ad878bdd2c2ed065a8c7faa87e3fb3289712
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sat Apr 27 20:41:29 2019 +0100

    Add -method for consistency
    
    Make -req an alias.

diff --git a/bin/varnishtest/tests/a00002.vtc b/bin/varnishtest/tests/a00002.vtc
index 2d8c755fe..56bb068f5 100644
--- a/bin/varnishtest/tests/a00002.vtc
+++ b/bin/varnishtest/tests/a00002.vtc
@@ -11,7 +11,7 @@ server s1 {
 server s1 -start
 
 client c1 -connect ${s1_sock} {
-	txreq -req PUT -proto HTTP/1.0 -url /foo
+	txreq -method PUT -proto HTTP/1.0 -url /foo
 	rxresp
 	expect resp.proto == HTTP/1.2
 	expect resp.status == 201
diff --git a/bin/varnishtest/tests/a02014.vtc b/bin/varnishtest/tests/a02014.vtc
index d11af49b9..0dd7d71e1 100644
--- a/bin/varnishtest/tests/a02014.vtc
+++ b/bin/varnishtest/tests/a02014.vtc
@@ -22,7 +22,7 @@ server s1 {
 } -start
 client c1 -connect ${s1_sock} {
 	stream 1 {
-		txreq -req GET -url /1 \
+		txreq -method GET -url /1 \
 			-hdr :scheme http -hdr :authority localhost
 		rxresp
 		expect stream.weight == 16
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 5d75e6ef4..d4e03999f 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -979,9 +979,12 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
  *         from who can send them is that the first line (request line vs
  *         status line), so all the options are prety much the same.
  *
- *         \-req STRING (txreq only)
+ *         \-method STRING (txreq only)
  *                 What method to use (default: "GET").
  *
+ *         \-req STRING (txreq only)
+ *                 Alias for -method.
+ *
  *         \-url STRING (txreq only)
  *                 What location to use (default "/").
  *
@@ -1295,7 +1298,8 @@ cmd_http_txreq(CMD_ARGS)
 		} else if (!strcmp(*av, "-proto")) {
 			proto = av[1];
 			av++;
-		} else if (!strcmp(*av, "-req")) {
+		} else if (!strcmp(*av, "-method") ||
+		    !strcmp(*av, "-req")) {
 			req = av[1];
 			hp->head_method = !strcasecmp(av[1], "HEAD") ;
 			av++;
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 00f254b1e..f49f955dc 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -1286,9 +1286,12 @@ cmd_sendhex(CMD_ARGS)
  * \-url STRING (txreq, txpush)
  *	Set the :path pseudo-header.
  *
- * \-req STRING (txreq, txpush)
+ * \-method STRING (txreq, txpush)
  *	Set the :method pseudo-header.
  *
+ * \-req STRING (txreq, txpush)
+ *	Alias for -method.
+ *
  * \-scheme STRING (txreq, txpush)
  *	Set the :scheme pseudo-header.
  *
@@ -1437,7 +1440,7 @@ cmd_tx11obj(CMD_ARGS)
 			av++;
 			path_done = 1;
 		}
-		else if (AV_IS("-req") &&
+		else if ((AV_IS("-method") || AV_IS("-req")) &&
 				(CMD_IS("txreq") || CMD_IS("txpush"))) {
 			ENC(hdr, ":method", av[1]);
 			av++;


More information about the varnish-commit mailing list