Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
86c3fa0d
Commit
86c3fa0d
authored
Jan 08, 2022
by
neil
Browse files
remove retry for get and post
parent
75ae57e1
Changes
1
Show whitespace changes
Inline
Side-by-side
acme.sh
View file @
86c3fa0d
...
@@ -1831,8 +1831,6 @@ _inithttp() {
...
@@ -1831,8 +1831,6 @@ _inithttp() {
}
}
_HTTP_MAX_RETRY=8
# body url [needbase64] [POST|PUT|DELETE] [ContentType]
# body url [needbase64] [POST|PUT|DELETE] [ContentType]
_post
()
{
_post
()
{
body
=
"
$1
"
body
=
"
$1
"
...
@@ -1840,33 +1838,6 @@ _post() {
...
@@ -1840,33 +1838,6 @@ _post() {
needbase64
=
"
$3
"
needbase64
=
"
$3
"
httpmethod
=
"
$4
"
httpmethod
=
"
$4
"
_postContentType
=
"
$5
"
_postContentType
=
"
$5
"
_sleep_retry_sec=1
_http_retry_times=0
_hcode=0
while [ "${_http_retry_times}" -le "$_HTTP_MAX_RETRY" ]; do
[ "$_http_retry_times" = "$_HTTP_MAX_RETRY" ]
_lastHCode="$?"
_debug "Retrying post"
_post_impl "$body" "$_post_url" "$needbase64" "$httpmethod" "$_postContentType" "$_lastHCode"
_hcode="$?"
_debug _hcode "$_hcode"
if [ "$_hcode" = "0" ]; then
break
fi
_http_retry_times=$(_math $_http_retry_times + 1)
_sleep $_sleep_retry_sec
done
return $_hcode
}
# body url [needbase64] [POST|PUT|DELETE] [ContentType] [displayError]
_post_impl() {
body="$1"
_post_url="$2"
needbase64="$3"
httpmethod="$4"
_postContentType="$5"
displayError="$6"
if
[
-z
"
$httpmethod
"
]
;
then
if
[
-z
"
$httpmethod
"
]
;
then
httpmethod
=
"POST"
httpmethod
=
"POST"
...
@@ -1918,9 +1889,7 @@ _post_impl() {
...
@@ -1918,9 +1889,7 @@ _post_impl() {
fi
fi
_ret
=
"
$?
"
_ret
=
"
$?
"
if
[
"
$_ret
"
!=
"0"
]
;
then
if
[
"
$_ret
"
!=
"0"
]
;
then
if [ -z "$displayError" ] || [ "$displayError" = "0" ]; then
_err
"Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code:
$_ret
"
_err
"Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code:
$_ret
"
fi
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
_err
"Here is the curl dump log:"
_err
"Here is the curl dump log:"
_err
"
$(
cat
"
$_CURL_DUMP
"
)
"
_err
"
$(
cat
"
$_CURL_DUMP
"
)
"
...
@@ -1976,10 +1945,8 @@ _post_impl() {
...
@@ -1976,10 +1945,8 @@ _post_impl() {
_debug
"wget returns 8, the server returns a 'Bad request' response, lets process the response later."
_debug
"wget returns 8, the server returns a 'Bad request' response, lets process the response later."
fi
fi
if
[
"
$_ret
"
!=
"0"
]
;
then
if
[
"
$_ret
"
!=
"0"
]
;
then
if [ -z "$displayError" ] || [ "$displayError" = "0" ]; then
_err
"Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code:
$_ret
"
_err
"Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code:
$_ret
"
fi
fi
fi
_sed_i
"s/^ *//g"
"
$HTTP_HEADER
"
_sed_i
"s/^ *//g"
"
$HTTP_HEADER
"
else
else
_ret
=
"
$?
"
_ret
=
"
$?
"
...
@@ -1992,38 +1959,13 @@ _post_impl() {
...
@@ -1992,38 +1959,13 @@ _post_impl() {
# url getheader timeout
# url getheader timeout
_get
()
{
_get
()
{
url="$1"
onlyheader="$2"
t="$3"
_sleep_retry_sec=1
_http_retry_times=0
_hcode=0
while [ "${_http_retry_times}" -le "$_HTTP_MAX_RETRY" ]; do
[ "$_http_retry_times" = "$_HTTP_MAX_RETRY" ]
_lastHCode="$?"
_debug "Retrying GET"
_get_impl "$url" "$onlyheader" "$t" "$_lastHCode"
_hcode="$?"
_debug _hcode "$_hcode"
if [ "$_hcode" = "0" ]; then
break
fi
_http_retry_times=$(_math $_http_retry_times + 1)
_sleep $_sleep_retry_sec
done
return $_hcode
}
# url getheader timeout displayError
_get_impl() {
_debug GET
_debug GET
url
=
"
$1
"
url
=
"
$1
"
onlyheader
=
"
$2
"
onlyheader
=
"
$2
"
t
=
"
$3
"
t
=
"
$3
"
displayError="$4"
_debug url
"
$url
"
_debug url
"
$url
"
_debug
"timeout=
$t
"
_debug
"timeout=
$t
"
_debug "displayError" "$displayError"
_inithttp
_inithttp
if
[
"
$_ACME_CURL
"
]
&&
[
"
${
ACME_USE_WGET
:-
0
}
"
=
"0"
]
;
then
if
[
"
$_ACME_CURL
"
]
&&
[
"
${
ACME_USE_WGET
:-
0
}
"
=
"0"
]
;
then
...
@@ -2042,9 +1984,7 @@ _get_impl() {
...
@@ -2042,9 +1984,7 @@ _get_impl() {
fi
fi
ret
=
$?
ret
=
$?
if
[
"
$ret
"
!=
"0"
]
;
then
if
[
"
$ret
"
!=
"0"
]
;
then
if [ -z "$displayError" ] || [ "$displayError" = "0" ]; then
_err
"Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code:
$ret
"
_err
"Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code:
$ret
"
fi
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
_err
"Here is the curl dump log:"
_err
"Here is the curl dump log:"
_err
"
$(
cat
"
$_CURL_DUMP
"
)
"
_err
"
$(
cat
"
$_CURL_DUMP
"
)
"
...
@@ -2070,10 +2010,8 @@ _get_impl() {
...
@@ -2070,10 +2010,8 @@ _get_impl() {
_debug
"wget returns 8, the server returns a 'Bad request' response, lets process the response later."
_debug
"wget returns 8, the server returns a 'Bad request' response, lets process the response later."
fi
fi
if
[
"
$ret
"
!=
"0"
]
;
then
if
[
"
$ret
"
!=
"0"
]
;
then
if [ -z "$displayError" ] || [ "$displayError" = "0" ]; then
_err
"Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code:
$ret
"
_err
"Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code:
$ret
"
fi
fi
fi
else
else
ret
=
$?
ret
=
$?
_err
"Neither curl nor wget is found, can not do GET."
_err
"Neither curl nor wget is found, can not do GET."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment