Skip to content

Commit c2ad1b4

Browse files
authored
Merge pull request #4448 from PMExtra/feature/curl_fail
curl return fail if HTTP errors
2 parents ba9d146 + a5b04a0 commit c2ad1b4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

acme.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,14 @@ _inithttp() {
18521852
_ACME_CURL="$_ACME_CURL --cacert $CA_BUNDLE "
18531853
fi
18541854

1855-
if _contains "$(curl --help 2>&1)" "--globoff"; then
1855+
if _contains "$(curl --help 2>&1)" "--globoff" || _contains "$(curl --help curl 2>&1)" "--globoff"; then
18561856
_ACME_CURL="$_ACME_CURL -g "
18571857
fi
1858+
1859+
#from curl 7.76: return fail on HTTP errors but keep the body
1860+
if _contains "$(curl --help http 2>&1)" "--fail-with-body"; then
1861+
_ACME_CURL="$_ACME_CURL --fail-with-body "
1862+
fi
18581863
fi
18591864

18601865
if [ -z "$_ACME_WGET" ] && _exists "wget"; then
@@ -1872,11 +1877,11 @@ _inithttp() {
18721877
elif [ "$CA_BUNDLE" ]; then
18731878
_ACME_WGET="$_ACME_WGET --ca-certificate=$CA_BUNDLE "
18741879
fi
1875-
fi
18761880

1877-
#from wget 1.14: do not skip body on 404 error
1878-
if [ "$_ACME_WGET" ] && _contains "$($_ACME_WGET --help 2>&1)" "--content-on-error"; then
1879-
_ACME_WGET="$_ACME_WGET --content-on-error "
1881+
#from wget 1.14: do not skip body on 404 error
1882+
if _contains "$(wget --help 2>&1)" "--content-on-error"; then
1883+
_ACME_WGET="$_ACME_WGET --content-on-error "
1884+
fi
18801885
fi
18811886

18821887
__HTTP_INITIALIZED=1

0 commit comments

Comments
 (0)