Re: [Bug-wget] Why limit --max-redirect can results in exit_status 8?

2019-08-11 Thread Tim Rühsen
On 09.08.19 22:37, Peng Yu wrote:
> Hi,
> 
> The exit status 8 means "Server issued an error response." But I think
> the exit status may not be considered as an error in the specific use
> case. Is there a way to make wget return 0 instead?
> 
> $ wget -q --spider -S -o /dev/null --max-redirect 1
> https://httpbin.org/absolute-redirect/3 || echo $?
> 8
> $ wget -q --spider -S -o /dev/null
> https://httpbin.org/absolute-redirect/3 || echo $?
> 8

'8' could be one of several (pretty many) different errors. The value
aggregates / simplifies error handling.

If you are going to batch test servers/URLs for their headers, you might
take a look at wget2. It has a statistics output for each URL/server
including number of links (with max-redirect it would be 0 or 1).

Looks for '--stats-site' at
https://gnuwget.gitlab.io/wget2/reference/md_wget2.html.

If you are able to read/write C code, fork/download the project from
Gitlab and check the examples/.

Regards, Tim



signature.asc
Description: OpenPGP digital signature


[Bug-wget] Why limit --max-redirect can results in exit_status 8?

2019-08-09 Thread Peng Yu
Hi,

The exit status 8 means "Server issued an error response." But I think
the exit status may not be considered as an error in the specific use
case. Is there a way to make wget return 0 instead?

$ wget -q --spider -S -o /dev/null --max-redirect 1
https://httpbin.org/absolute-redirect/3 || echo $?
8
$ wget -q --spider -S -o /dev/null
https://httpbin.org/absolute-redirect/3 || echo $?
8
-- 
Regards,
Peng