1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

MFC: fetch(1): suppress "Not Modified" in quiet mode

"fetch -qi" should skip printing "Not Modified" for successful
http(s) request. Still print it by default (v_level == 1).

(cherry picked from commit 7a6309fdc7)
This commit is contained in:
Eugene Grosbein 2024-09-07 09:14:23 +07:00
parent 818a8f2ef3
commit 251d93eda0

View File

@ -583,16 +583,17 @@ fetch(char *URL, const char *path, int *is_http)
if (sigalrm || sigint)
goto signal;
if (f == NULL) {
warnx("%s: %s", URL, fetchLastErrString);
if (i_flag && (strcmp(url->scheme, SCHEME_HTTP) == 0 ||
strcmp(url->scheme, SCHEME_HTTPS) == 0) &&
fetchLastErrCode == FETCH_OK &&
if (i_flag && *is_http && fetchLastErrCode == FETCH_OK &&
strcmp(fetchLastErrString, "Not Modified") == 0) {
/* HTTP Not Modified Response, return OK. */
if (v_level > 0)
warnx("%s: %s", URL, fetchLastErrString);
r = 0;
goto done;
} else
} else {
warnx("%s: %s", URL, fetchLastErrString);
goto failure;
}
}
if (sigint)
goto signal;