mirror of
https://github.com/curl/curl.git
synced 2026-08-26 23:04:24 +03:00
tests/client: use curl_mfprintf()
Replacing `fprintf()`. `curl_mfprintf()` is a public libcurl API.
Following the same change made for libtests.
Follow-up to 255aac56f9 #17253
Closes #17651
This commit is contained in:
parent
a4a13c96ca
commit
af309fb17b
11 changed files with 186 additions and 181 deletions
|
|
@ -30,7 +30,7 @@ static int my_trace(CURL *handle, curl_infotype type,
|
|||
(void)userp;
|
||||
switch(type) {
|
||||
case CURLINFO_TEXT:
|
||||
fprintf(stderr, "== Info: %s", data);
|
||||
curl_mfprintf(stderr, "== Info: %s", data);
|
||||
return 0;
|
||||
case CURLINFO_HEADER_OUT:
|
||||
text = "=> Send header";
|
||||
|
|
@ -104,7 +104,7 @@ static int server_push_callback(CURL *parent,
|
|||
out = fopen(filename, "wb");
|
||||
if(!out) {
|
||||
/* if we cannot save it, deny it */
|
||||
fprintf(stderr, "Failed to create output file for push\n");
|
||||
curl_mfprintf(stderr, "Failed to create output file for push\n");
|
||||
rv = CURL_PUSH_DENY;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -112,17 +112,18 @@ static int server_push_callback(CURL *parent,
|
|||
/* write to this file */
|
||||
curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
|
||||
|
||||
fprintf(stderr, "**** push callback approves stream %u, got %lu headers!\n",
|
||||
count, (unsigned long)num_headers);
|
||||
curl_mfprintf(stderr, "**** push callback approves stream %u, "
|
||||
"got %lu headers!\n", count, (unsigned long)num_headers);
|
||||
|
||||
for(i = 0; i < num_headers; i++) {
|
||||
headp = curl_pushheader_bynum(headers, i);
|
||||
fprintf(stderr, "**** header %lu: %s\n", (unsigned long)i, headp);
|
||||
curl_mfprintf(stderr, "**** header %lu: %s\n", (unsigned long)i, headp);
|
||||
}
|
||||
|
||||
headp = curl_pushheader_byname(headers, ":path");
|
||||
if(headp) {
|
||||
fprintf(stderr, "**** The PATH is %s\n", headp /* skip :path + colon */);
|
||||
curl_mfprintf(stderr, "**** The PATH is %s\n",
|
||||
headp /* skip :path + colon */);
|
||||
}
|
||||
|
||||
(*transfers)++; /* one more */
|
||||
|
|
@ -144,7 +145,7 @@ static int test_h2_serverpush(int argc, char *argv[])
|
|||
const char *url;
|
||||
|
||||
if(argc != 2) {
|
||||
fprintf(stderr, "need URL as argument\n");
|
||||
curl_mfprintf(stderr, "need URL as argument\n");
|
||||
return 2;
|
||||
}
|
||||
url = argv[1];
|
||||
|
|
@ -156,7 +157,7 @@ static int test_h2_serverpush(int argc, char *argv[])
|
|||
|
||||
easy = curl_easy_init();
|
||||
if(setup_h2_serverpush(easy, url)) {
|
||||
fprintf(stderr, "failed\n");
|
||||
curl_mfprintf(stderr, "failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue