Request for Clarifications: Exit Codes
I'm looking into how Wget2 handles setting its exit status and I'm trying to clean that up a little. In the code, I see the following snippet:
// Wget1.x compatibility
if (resp->code/100 == 4 && resp->code!=416) {
if (job->head_first)
set_exit_status(8);
else if (resp->code == 404 && !job->robotstxt)
set_exit_status(8);
}
@rockdaboot Could you please explain this a little to me? From what I understand, if the response is a 4XX response, and this was a HEAD request we return with $? = 8
. Or if the response was a 404 but this wasn't a robots job, we exit as well. Why the specific check for job->head_first
?
Also, since both the branches set the same exit status, why not merge them?
Another question that arises is that these only set the exit status, but don't exit out of the function. Should this be changed a little to be more readable and understandable?