fix _get
This commit is contained in:
parent
7fb77203ad
commit
2229047afd
2
acme.sh
2
acme.sh
@ -1942,7 +1942,7 @@ _get() {
|
|||||||
fi
|
fi
|
||||||
_debug "_CURL" "$_CURL"
|
_debug "_CURL" "$_CURL"
|
||||||
if [ "$onlyheader" ]; then
|
if [ "$onlyheader" ]; then
|
||||||
$_CURL -X GET -I --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
|
$_CURL -I --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
|
||||||
else
|
else
|
||||||
$_CURL --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
|
$_CURL --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -87,8 +87,12 @@ _get_root() {
|
|||||||
_use_instance_role() {
|
_use_instance_role() {
|
||||||
_url="http://100.100.100.200/latest/meta-data/ram/security-credentials/"
|
_url="http://100.100.100.200/latest/meta-data/ram/security-credentials/"
|
||||||
_debug "_url" "$_url"
|
_debug "_url" "$_url"
|
||||||
if ! _get "$_url" true 1 | _head_n 1 | grep -Fq 200; then
|
|
||||||
_debug "Unable to fetch IAM role from instance metadata"
|
# **Do Not** set the parameter `onlyheadr` for _get, it will
|
||||||
|
# send a HEAD request instead of GET. And alicloud
|
||||||
|
# mata url not allow HEAD request.
|
||||||
|
if _get "$_url" "" 1 | grep '404 - Not Found' > /dev/null; then
|
||||||
|
_debug "Unable to fetch RAM role from instance metadata"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_ali_instance_role=$(_get "$_url" "" 1)
|
_ali_instance_role=$(_get "$_url" "" 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user