diff --git a/docs/cmdline-opts/silent.md b/docs/cmdline-opts/silent.md index 2498ca56f4..ac7dc5abed 100644 --- a/docs/cmdline-opts/silent.md +++ b/docs/cmdline-opts/silent.md @@ -17,8 +17,8 @@ Example: # `--silent` -Silent or quiet mode. Do not show progress meter, warning messages or error -messages. Makes curl mute. It still outputs the data you ask for, potentially +Silent or quiet mode. Do not show progress meter, note messages, warning +messages or error messages. Makes curl mute. It still outputs the data you ask for, potentially even to the terminal/stdout unless you redirect it. Use --show-error in addition to this option to disable progress meter but diff --git a/src/tool_msgs.c b/src/tool_msgs.c index 2e1245503f..50a2fa0860 100644 --- a/src/tool_msgs.c +++ b/src/tool_msgs.c @@ -74,11 +74,11 @@ static void voutf(const char *prefix, const char *fmt, va_list ap) /* * Emit 'note' formatted message on configured 'errors' stream, if verbose was - * selected. + * selected and mute (--silent) was not. */ void notef(const char *fmt, ...) { - if(global && global->tracetype) { + if(global && global->tracetype && !global->silent) { va_list ap; va_start(ap, fmt); voutf(NOTE_PREFIX, fmt, ap); diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 5291ccc232..7238eed749 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -225,7 +225,7 @@ test1685 test1686 \ \ test1700 test1702 test1703 test1704 test1705 test1706 test1707 \ test1708 test1709 test1710 test1711 test1712 test1713 test1714 test1715 \ -test1720 test1721 test1722 test1723 test1724 test1725 \ +test1720 test1721 test1722 test1723 test1724 test1725 test1740 test1741 \ \ test1800 test1801 test1802 test1847 test1848 test1849 test1850 test1851 \ \ diff --git a/tests/data/test1740 b/tests/data/test1740 new file mode 100644 index 0000000000..dda4b39775 --- /dev/null +++ b/tests/data/test1740 @@ -0,0 +1,58 @@ + + + + +HTTP +HTTP POST +--silent + + + +# Server-side + + +HTTP/1.1 200 OK +Date: Tue, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Content-Length: 6 +Connection: close +Content-Type: text/html + +-foo- + + + +# Client-side + + +http + + +# set the terminal wide to avoid word wrap in the message +COLUMNS=10000 + + +--silent suppresses Note: messages when verbose + + +http://%HOSTIP:%HTTPPORT/%TESTNUMBER --silent -X POST -d foo -o %LOGDIR/out%TESTNUMBER -w '%{stderr}done\n' + + + +# Verify data after the test has been "shot" + + +POST /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Content-Length: 3 +Content-Type: application/x-www-form-urlencoded + +foo + + +done + + + diff --git a/tests/data/test1741 b/tests/data/test1741 new file mode 100644 index 0000000000..e2e5cd8389 --- /dev/null +++ b/tests/data/test1741 @@ -0,0 +1,58 @@ + + + + +HTTP +HTTP POST + + + +# Server-side + + +HTTP/1.1 200 OK +Date: Tue, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Content-Length: 6 +Connection: close +Content-Type: text/html + +-foo- + + + +# Client-side + + +http + + +# set the terminal wide to avoid word wrap in the message +COLUMNS=10000 + + +Note: messages are shown when verbose without --silent + + +http://%HOSTIP:%HTTPPORT/%TESTNUMBER -X POST -d foo -o %LOGDIR/out%TESTNUMBER --no-progress-meter -w '%{stderr}done\n' + + + +# Verify data after the test has been "shot" + + +POST /%TESTNUMBER HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +User-Agent: curl/%VERSION +Accept: */* +Content-Length: 3 +Content-Type: application/x-www-form-urlencoded + +foo + + +Note: Unnecessary use of -X or --request, POST is already inferred. +done + + +