]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_writeout: make %{errormsg} blank for no errors
authorDaniel Stenberg <daniel@haxx.se>
Wed, 27 Jan 2021 15:39:24 +0000 (16:39 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 28 Jan 2021 06:55:25 +0000 (07:55 +0100)
Closes #6539

src/tool_writeout.c
tests/data/test1029

index 9ce0a997e5b574c7dfac28cc3a84283e90f53992..c548bd8f2d455d0637380e9235ed35ceb3ea2901 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -137,8 +137,9 @@ void ourWriteOut(CURL *curl, struct per_transfer *per, const char *writeinfo,
                 fprintf(stream, "%d", (int)result);
                 break;
               case VAR_ERRORMSG:
-                fputs(per->errorbuffer[0] ? per->errorbuffer :
-                      curl_easy_strerror(result), stream);
+                if(result)
+                  fputs(per->errorbuffer[0] ? per->errorbuffer :
+                        curl_easy_strerror(result), stream);
                 break;
               case VAR_INPUT_URL:
                 if(per->this_url)
index 36797e3347d7f3d02cec3a0c8dcf128a43f7877b..b1f5982e488529c561e690754cef2ed76a41edc9 100644 (file)
@@ -50,7 +50,7 @@ Content-Length: 62
 Connection: close\r
 \r
 This server reply is for testing a simple Location: following
-http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/1029 0 No error
+http://%HOSTIP:%HTTPPORT/we/want/our/data/10290002.txt?coolsite=yes http://%HOSTIP:%HTTPPORT/we/want/our/1029 0 
 </stdout>
 </verify>
 </testcase>