Browse Source

Optimized login function

pull/3754/head
Jinhill 4 years ago
parent
commit
0d6864ca4a
  1. 8
      dnsapi/dns_geos.sh

8
dnsapi/dns_geos.sh

@ -21,12 +21,11 @@ log(){
#$1:url
url_encode() {
echo "$1" | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | while read -r l;
do
echo "$1" | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | while read -r l; do
case "$l" in
[-_.~a-zA-Z0-9]) printf '%s' "$l" ;;
"") printf '%%20' ;;
* ) printf '%%%02X' "'$l"
*) printf '%%%02X' "'$l" ;;
esac
done
}
@ -69,6 +68,7 @@ login() {
if [ "${http_code}" = "302" ]; then
return 0
fi
rm -rf "${COOKIE_FILE}"
_err "geoscaling login failed for user ${GEOS_Username} bad RC from post"
return 1
}
@ -83,7 +83,7 @@ get_zone() {
items=$(echo "${table}" | grep -oE '<a [^>]+><b>[^>]+>')
i=1
c=$(count "$1" ".")
while [ $i -le $c ]; do
while [ $i -le "$c" ]; do
d=$(echo "$1" | cut -d . -f $i-)
if [ -z "$d" ]; then
return 1

Loading…
Cancel
Save