Browse Source

add curl error message.

pull/205/head
neil 9 years ago
parent
commit
9aaf36cd0c
  1. 26
      acme.sh

26
acme.sh

@ -586,9 +586,9 @@ _post() {
if _exists "curl" ; then if _exists "curl" ; then
_CURL="$CURL --dump-header $HTTP_HEADER " _CURL="$CURL --dump-header $HTTP_HEADER "
if [ "$needbase64" ] ; then if [ "$needbase64" ] ; then
response="$($_CURL -A "User-Agent: $USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" --data "$body" "$url" | _base64)"
response="$($_CURL -A "User-Agent: $USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" --data "$body" "$url" 2>"$HTTP_ERROR_FILE" | _base64)"
else else
response="$($_CURL -A "User-Agent: $USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" --data "$body" "$url" )"
response="$($_CURL -A "User-Agent: $USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" --data "$body" "$url" 2>"$HTTP_ERROR_FILE" )"
fi fi
_ret="$?" _ret="$?"
else else
@ -609,6 +609,9 @@ _post() {
_sed_i "s/^ *//g" "$HTTP_HEADER" _sed_i "s/^ *//g" "$HTTP_HEADER"
fi fi
_debug "_ret" "$_ret" _debug "_ret" "$_ret"
if [ "$ret" != "0" ] ; then
_err "$(cat "$HTTP_ERROR_FILE")"
fi
printf "%s" "$response" printf "%s" "$response"
return $_ret return $_ret
} }
@ -621,19 +624,24 @@ _get() {
_debug url $url _debug url $url
if _exists "curl" ; then if _exists "curl" ; then
if [ "$onlyheader" ] ; then if [ "$onlyheader" ] ; then
$CURL -I -A "User-Agent: $USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" $url
$CURL -I -A "User-Agent: $USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" $url 2>"$HTTP_ERROR_FILE"
else else
$CURL -A "User-Agent: $USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" $url
$CURL -A "User-Agent: $USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" $url 2>"$HTTP_ERROR_FILE"
fi fi
ret=$?
else else
_debug "WGET" "$WGET" _debug "WGET" "$WGET"
if [ "$onlyheader" ] ; then if [ "$onlyheader" ] ; then
$WGET --user-agent="$USER_AGENT" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null $url 2>&1 | sed 's/^[ ]*//g' $WGET --user-agent="$USER_AGENT" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null $url 2>&1 | sed 's/^[ ]*//g'
else else
$WGET --user-agent="$USER_AGENT" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -O - $url
$WGET --user-agent="$USER_AGENT" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -O - $url 2>"$HTTP_ERROR_FILE"
fi fi
ret=$?
fi
if [ "$ret" != "0" ] ; then
_err "$(cat "$HTTP_ERROR_FILE")"
fi fi
ret=$?
return $ret return $ret
} }
@ -870,6 +878,7 @@ _initpath() {
fi fi
HTTP_HEADER="$LE_WORKING_DIR/http.header" HTTP_HEADER="$LE_WORKING_DIR/http.header"
HTTP_ERROR_FILE="$LE_WORKING_DIR/http.err"
WGET="wget -q" WGET="wget -q"
if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ] ; then if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ] ; then
@ -1456,13 +1465,16 @@ issue() {
_debug "sleep 5 secs to verify" _debug "sleep 5 secs to verify"
sleep 5 sleep 5
_debug "checking" _debug "checking"
response="$(_get $uri | _normalizeJson )"
response="$(_get $uri)"
if [ "$?" != "0" ] ; then if [ "$?" != "0" ] ; then
_err "$d:Verify error:$response" _err "$d:Verify error:$response"
_clearupwebbroot "$_currentRoot" "$removelevel" "$token" _clearupwebbroot "$_currentRoot" "$removelevel" "$token"
_clearup _clearup
return 1 return 1
fi fi
_debug2 original "$response"
response="$(echo "$response" | _normalizeJson )"
_debug2 response "$response" _debug2 response "$response"
status=$(echo $response | egrep -o '"status":"[^"]*' | cut -d : -f 2 | tr -d '"') status=$(echo $response | egrep -o '"status":"[^"]*' | cut -d : -f 2 | tr -d '"')

Loading…
Cancel
Save