Skip to content

Commit 9a632e3

Browse files
committed
re-add return codes
1 parent c98ed2d commit 9a632e3

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

testssl.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,8 +1862,9 @@ http_get() {
18621862
fi
18631863
}
18641864

1865-
# Outputs the headers when downloading any URL (arg1) via HTTP 1.1 GET from port 80.
1866-
# arg2 is optional and could be a http_header
1865+
# Outputs the HTTP headers via HTTP 1.1 HEAD command bia HTTPS and a valid certificate
1866+
# arg1 is the URL
1867+
# arg2 is optional and could be a request header. curl/wget don't send empty headers otherwise
18671868
#
18681869
# Only works if curl or wget is available.
18691870
# The proxy environment variable is used automatically.
@@ -1889,10 +1890,10 @@ http_get_header() {
18891890
response_headers="$(curl $xtra_params -x $PROXYIP:$PROXYPORT -H $''"$request_header"'' -A $''"$useragent"'' "$1")"
18901891
fi
18911892
ret=$?
1892-
tm_out "$response_headers"
1893+
[[ $ret -eq 0 ]] && tm_out "$response_headers"
18931894
return $ret
18941895
elif type -p wget &>/dev/null; then
1895-
xtra_params="--timeout=$HEADER_MAXSLEEP --tries=1 --content-on-error --cache=off"
1896+
xtra_params="--timeout=$HEADER_MAXSLEEP --tries=1 --cache=off"
18961897
# wget has no proxy command line. We need to use http_proxy instead. And for the sake of simplicity
18971898
# assume the GET protocol we query is using http -- http_proxy is the $ENV not for the connection TO
18981899
# the proxy, but for the protocol we query THROUGH the proxy
@@ -1906,7 +1907,7 @@ http_get_header() {
19061907
fi
19071908
fi
19081909
ret=$?
1909-
tm_out "$response_headers"
1910+
[[ $ret -eq 0 ]] && tm_out "$response_headers"
19101911
# wget(1): "8: Server issued an error response.". Happens e.g. when 404 is returned. However also if the call wasn't correct (400)
19111912
# So we assume for now that everything is submitted correctly. We parse the error code too later
19121913
[[ $ret -eq 8 ]] && ret=0 && tm_out "$response_headers"

0 commit comments

Comments
 (0)