Unverified Commit ff8de344 authored by neil's avatar neil Committed by GitHub
Browse files

Merge pull request #4335 from acmesh-official/dev

sync
parents 70ed6b96 f8ca6d98
...@@ -1235,7 +1235,7 @@ _createcsr() { ...@@ -1235,7 +1235,7 @@ _createcsr() {
_debug2 csr "$csr" _debug2 csr "$csr"
_debug2 csrconf "$csrconf" _debug2 csrconf "$csrconf"
printf "[ req_distinguished_name ]\n[ req ]\ndistinguished_name = req_distinguished_name\nreq_extensions = v3_req\n[ v3_req ]\n\n" >"$csrconf" printf "[ req_distinguished_name ]\n[ req ]\ndistinguished_name = req_distinguished_name\nreq_extensions = v3_req\n[ v3_req ]\nextendedKeyUsage=serverAuth,clientAuth\n" >"$csrconf"
if [ "$acmeValidationv1" ]; then if [ "$acmeValidationv1" ]; then
domainlist="$(_idn "$domainlist")" domainlist="$(_idn "$domainlist")"
...@@ -1999,7 +1999,13 @@ _post() { ...@@ -1999,7 +1999,13 @@ _post() {
if [ "$_ret" != "0" ]; then if [ "$_ret" != "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
_sed_i "s/^ *//g" "$HTTP_HEADER" if _contains "$_WGET" " -d "; then
# Demultiplex wget debug output
cat "$HTTP_HEADER" >&2
_sed_i '/^[^ ][^ ]/d; /^ *$/d' "$HTTP_HEADER"
fi
# remove leading whitespaces from header to match curl format
_sed_i 's/^ //g' "$HTTP_HEADER"
else else
_ret="$?" _ret="$?"
_err "Neither curl nor wget is found, can not do $httpmethod." _err "Neither curl nor wget is found, can not do $httpmethod."
...@@ -2052,9 +2058,21 @@ _get() { ...@@ -2052,9 +2058,21 @@ _get() {
fi fi
_debug "_WGET" "$_WGET" _debug "_WGET" "$_WGET"
if [ "$onlyheader" ]; then if [ "$onlyheader" ]; then
$_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null "$url" 2>&1 | sed 's/^[ ]*//g' _wget_out = "$($_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null "$url" 2>&1)"
if _contains "$_WGET" " -d "; then
# Demultiplex wget debug output
echo "$_wget_out" >&2
echo "$_wget_out" | sed '/^[^ ][^ ]/d; /^ *$/d; s/^ //g' -
fi
else else
$_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -O - "$url" $_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O - "$url" 2>"$HTTP_HEADER"
if _contains "$_WGET" " -d "; then
# Demultiplex wget debug output
cat "$HTTP_HEADER" >&2
_sed_i '/^[^ ][^ ]/d; /^ *$/d' "$HTTP_HEADER"
fi
# remove leading whitespaces from header to match curl format
_sed_i 's/^ //g' "$HTTP_HEADER"
fi fi
ret=$? ret=$?
if [ "$ret" = "8" ]; then if [ "$ret" = "8" ]; then
......
...@@ -173,7 +173,7 @@ cpanel_uapi_deploy() { ...@@ -173,7 +173,7 @@ cpanel_uapi_deploy() {
######## Private functions ##################### ######## Private functions #####################
# Internal utility to process YML from UAPI - only looks at main_domain and sub_domains # Internal utility to process YML from UAPI - looks at main_domain, sub_domains, addon domains and parked domains
#[response] #[response]
__cpanel_parse_response() { __cpanel_parse_response() {
if [ $# -gt 0 ]; then resp="$*"; else resp="$(cat)"; fi if [ $# -gt 0 ]; then resp="$*"; else resp="$(cat)"; fi
...@@ -194,7 +194,7 @@ __cpanel_parse_response() { ...@@ -194,7 +194,7 @@ __cpanel_parse_response() {
printf("%s%s=%s\n", prefix, $2, $3); printf("%s%s=%s\n", prefix, $2, $3);
} }
}' | }' |
sed -En -e 's/^result\/data\/(main_domain|sub_domains\/-)=(.*)$/\2/p' sed -En -e 's/^result\/data\/(main_domain|sub_domains\/-|addon_domains\/-|parked_domains\/-)=(.*)$/\2/p'
} }
# Load parameter by prefix+name - fallback to default if not set, and save to config # Load parameter by prefix+name - fallback to default if not set, and save to config
......
...@@ -139,8 +139,8 @@ _get_root() { ...@@ -139,8 +139,8 @@ _get_root() {
} }
_successful_update() { _successful_update() {
if (echo "$_result" | grep -q 'newserial'); then return 0; fi if (echo "$_result" | _egrep_o 'data":\[[^]]*]' | grep -q '"newserial":null'); then return 1; fi
return 1 return 0
} }
_findentry() { _findentry() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment