mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-06 03:27:41 +00:00
Implement retry to load subdomain page if first attempt fails.
Sometimes FreeDNS does not reurn the subdomain page but rather returns a page regarding becoming a premium member. This usually happens after a period of inactivity. Immediately trying again returns the correct subdomain page. So, we will try twice to load the page
This commit is contained in:
parent
d280e4ad6d
commit
49e8ecd168
@ -51,6 +51,15 @@ dns_freedns_add() {
|
|||||||
i="$(_math "$i" - 1)"
|
i="$(_math "$i" - 1)"
|
||||||
sub_domain="$(echo "$fulldomain" | cut -d. -f -"$i")"
|
sub_domain="$(echo "$fulldomain" | cut -d. -f -"$i")"
|
||||||
|
|
||||||
|
# Sometimes FreeDNS does not reurn the subdomain page but rather
|
||||||
|
# returns a page regarding becoming a premium member. This usually
|
||||||
|
# happens after a period of inactivity. Immediately trying again
|
||||||
|
# returns the correct subdomain page. So, we will try twice to
|
||||||
|
# load the page and obtain our domain ID
|
||||||
|
attempts=2
|
||||||
|
while [ "$attempts" -gt "0" ]; do
|
||||||
|
attempts="$(_math "$attempts" - 1)"
|
||||||
|
|
||||||
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
if [ "$using_cached_cookies" = "true" ]; then
|
if [ "$using_cached_cookies" = "true" ]; then
|
||||||
@ -123,12 +132,21 @@ dns_freedns_add() {
|
|||||||
|
|
||||||
if [ -z "$DNSdomainid" ]; then
|
if [ -z "$DNSdomainid" ]; then
|
||||||
# If domain ID is empty then something went wrong (top level
|
# If domain ID is empty then something went wrong (top level
|
||||||
# domain not found at FreeDNS). Cannot proceed.
|
# domain not found at FreeDNS).
|
||||||
|
if [ "$attempts" = "0" ]; then
|
||||||
|
# exhausted maximum retry attempts
|
||||||
_debug "$htmlpage"
|
_debug "$htmlpage"
|
||||||
_debug "$subdomain_csv"
|
_debug "$subdomain_csv"
|
||||||
_err "Domain $top_domain not found at FreeDNS"
|
_err "Domain $top_domain not found at FreeDNS"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# break out of the 'retry' loop... we have found our domain ID
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
_info "Domain $top_domain not found at FreeDNS"
|
||||||
|
_info "Retry loading subdomain page ($attempts attempts remaining)"
|
||||||
|
done
|
||||||
|
|
||||||
if [ -z "$DNSdataid" ]; then
|
if [ -z "$DNSdataid" ]; then
|
||||||
# If data ID is empty then specific subdomain does not exist yet, need
|
# If data ID is empty then specific subdomain does not exist yet, need
|
||||||
@ -172,11 +190,19 @@ dns_freedns_rm() {
|
|||||||
|
|
||||||
# Need to read cookie from conf file again in case new value set
|
# Need to read cookie from conf file again in case new value set
|
||||||
# during login to FreeDNS when TXT record was created.
|
# during login to FreeDNS when TXT record was created.
|
||||||
|
# acme.sh does not have a _readaccountconf() fuction
|
||||||
#TODO acme.sh does not have a _readaccountconf() fuction
|
|
||||||
FREEDNS_COOKIE="$(_read_conf "$ACCOUNT_CONF_PATH" "FREEDNS_COOKIE")"
|
FREEDNS_COOKIE="$(_read_conf "$ACCOUNT_CONF_PATH" "FREEDNS_COOKIE")"
|
||||||
_debug "FreeDNS login cookies: $FREEDNS_COOKIE"
|
_debug "FreeDNS login cookies: $FREEDNS_COOKIE"
|
||||||
|
|
||||||
|
# Sometimes FreeDNS does not reurn the subdomain page but rather
|
||||||
|
# returns a page regarding becoming a premium member. This usually
|
||||||
|
# happens after a period of inactivity. Immediately trying again
|
||||||
|
# returns the correct subdomain page. So, we will try twice to
|
||||||
|
# load the page and obtain our TXT record.
|
||||||
|
attempts=2
|
||||||
|
while [ "$attempts" -gt "0" ]; do
|
||||||
|
attempts="$(_math "$attempts" - 1)"
|
||||||
|
|
||||||
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")"
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
return 1
|
return 1
|
||||||
@ -224,8 +250,9 @@ dns_freedns_rm() {
|
|||||||
# fi
|
# fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
# If we get this far we did not find a match.
|
# If we get this far we did not find a match (after two attempts)
|
||||||
# Not necessarily an error, but log anyway.
|
# Not necessarily an error, but log anyway.
|
||||||
_debug2 "$subdomain_csv"
|
_debug2 "$subdomain_csv"
|
||||||
_info "Cannot delete TXT record for $fulldomain/$txtvalue. Does not exist at FreeDNS"
|
_info "Cannot delete TXT record for $fulldomain/$txtvalue. Does not exist at FreeDNS"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user