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).

MFC after:	1 week
This commit is contained in:
Eugene Grosbein 2024-09-07 09:14:23 +07:00
parent 3df987c99d
commit 7a6309fdc7

View File

@ -582,16 +582,17 @@ again:
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;