[master] c8393e7b6 Move responsibility for appending [response was truncated] to 201 responses to varnishadm.

Poul-Henning Kamp phk at FreeBSD.org
Mon Dec 9 17:28:07 UTC 2019


commit c8393e7b6ef98fe2a84568c16067424874a93093
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Dec 9 17:26:02 2019 +0000

    Move responsibility for appending [response was truncated] to 201
    responses to varnishadm.
    
    Part of fix for: #3148

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 3a94413d8..6d42895f2 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -161,7 +161,7 @@ do_args(int sock, int argc, char * const *argv)
 	unsigned status;
 	char *answer = NULL;
 
-	for (i=0; i<argc; i++) {
+	for (i = 0; i < argc; i++) {
 		/* XXX: We should really CLI-quote these */
 		if (i > 0)
 			cli_write(sock, " ");
@@ -175,8 +175,12 @@ do_args(int sock, int argc, char * const *argv)
 	(void)close(sock);
 
 	printf("%s\n", answer);
-	if (status == CLIS_OK || status == CLIS_TRUNCATED)
+	if (status == CLIS_OK)
 		exit(0);
+	if (status == CLIS_TRUNCATED) {
+		printf("[response was truncated]\n");
+		exit(0);
+	}
 	fprintf(stderr, "Command failed with error code %u\n", status);
 	exit(1);
 }
@@ -254,6 +258,8 @@ pass_answer(int fd)
 		printf("%s\n", answer);
 		free(answer);
 	}
+        if (status == CLIS_TRUNCATED)
+		printf("[response was truncated]\n");
 	(void)fflush(stdout);
 }
 
diff --git a/bin/varnishtest/tests/r01169.vtc b/bin/varnishtest/tests/r01169.vtc
index 73e741d78..16b85f6f8 100644
--- a/bin/varnishtest/tests/r01169.vtc
+++ b/bin/varnishtest/tests/r01169.vtc
@@ -1,4 +1,4 @@
-varnishtest "cli_limit truncating full parameter listing - #1169"
+varnishtest "cli_limit *not* truncating full parameter listing by default - #1169"
 
 server s1 {
 	rxreq


More information about the varnish-commit mailing list