From eebe68ca65650e523fa69348feb9274eab99e7ba Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 19 Jun 2024 09:03:15 +0300 Subject: [PATCH] ipset: github disabled gzip support --- ipset/def.sh | 10 +++++++++- ipset/get_reestr_hostlist.sh | 2 +- ipset/get_reestr_preresolved.sh | 4 ++-- ipset/get_reestr_preresolved_smart.sh | 4 ++-- ipset/get_reestr_resolvable_domains.sh | 4 ++-- ipset/get_reestr_resolve.sh | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ipset/def.sh b/ipset/def.sh index 5e7bb43..4be9e8d 100644 --- a/ipset/def.sh +++ b/ipset/def.sh @@ -103,12 +103,20 @@ zzexist() { [ -f "$1.gz" ] || [ -f "$1" ] } +zztest() +{ + gzip -t "$1" 2>/dev/null +} zzcat() { if [ -f "$1.gz" ]; then gunzip -c "$1.gz" elif [ -f "$1" ]; then - cat "$1" + if zztest "$1"; then + gunzip -c "$1" + else + cat "$1" + fi fi } zz() diff --git a/ipset/get_reestr_hostlist.sh b/ipset/get_reestr_hostlist.sh index 79c2e6f..6691268 100755 --- a/ipset/get_reestr_hostlist.sh +++ b/ipset/get_reestr_hostlist.sh @@ -16,7 +16,7 @@ dl_checked() # $3 - minsize # $4 - maxsize # $5 - maxtime - curl -H "Accept-Encoding: gzip" -k --fail --max-time $5 --connect-timeout 10 --retry 4 --max-filesize $4 "$1" | gunzip - >"$2" || + curl -k --fail --max-time $5 --connect-timeout 10 --retry 4 --max-filesize $4 -o "$2" "$1" || { echo list download failed : $1 return 2 diff --git a/ipset/get_reestr_preresolved.sh b/ipset/get_reestr_preresolved.sh index db6f288..6e530e7 100755 --- a/ipset/get_reestr_preresolved.sh +++ b/ipset/get_reestr_preresolved.sh @@ -19,7 +19,7 @@ dl() # $2 - file # $3 - minsize # $4 - maxsize - curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 "$1" | gunzip - >"$TMPLIST" || + curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 -o "$TMPLIST" "$1" || { echo list download failed : $1 exit 2 @@ -29,7 +29,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zz "$2" <"$TMPLIST" + zzcat "$TMPLIST" | zz "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_reestr_preresolved_smart.sh b/ipset/get_reestr_preresolved_smart.sh index f4a1395..d31c0b3 100755 --- a/ipset/get_reestr_preresolved_smart.sh +++ b/ipset/get_reestr_preresolved_smart.sh @@ -19,7 +19,7 @@ dl() # $2 - file # $3 - minsize # $4 - maxsize - curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 "$1" | gunzip - >"$TMPLIST" || + curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 -o "$TMPLIST" "$1" || { echo list download failed : $1 exit 2 @@ -29,7 +29,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zz "$2" <"$TMPLIST" + zzcat "$TMPLIST" | zz "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_reestr_resolvable_domains.sh b/ipset/get_reestr_resolvable_domains.sh index fa4837f..d2defdc 100755 --- a/ipset/get_reestr_resolvable_domains.sh +++ b/ipset/get_reestr_resolvable_domains.sh @@ -18,7 +18,7 @@ dl() # $2 - file # $3 - minsize # $4 - maxsize - curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 "$1" | gunzip - >"$TMPLIST" || + curl -H "Accept-Encoding: gzip" -k --fail --max-time 120 --connect-timeout 10 --retry 4 --max-filesize $4 -o "$TMPLIST" "$1" || { echo list download failed : $1 exit 2 @@ -28,7 +28,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zz "$2" <"$TMPLIST" + zzcat "$TMPLIST" | zz "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_reestr_resolve.sh b/ipset/get_reestr_resolve.sh index 5421063..924a073 100755 --- a/ipset/get_reestr_resolve.sh +++ b/ipset/get_reestr_resolve.sh @@ -19,7 +19,7 @@ dl_checked() # $3 - minsize # $4 - maxsize # $5 - maxtime - curl -H "Accept-Encoding: gzip" -k --fail --max-time $5 --connect-timeout 10 --retry 4 --max-filesize $4 "$1" | gunzip - >"$2" || + curl -k --fail --max-time $5 --connect-timeout 10 --retry 4 --max-filesize $4 -o "$2" "$1" || { echo list download failed : $1 return 2