Hello,

I would like to inform you that I have fixed my problem by patching the code myself. The patch is as follows:

```

# ...
        result=$(
          /usr/lib/apt/apt-helper srv-lookup ${service}.${d} |
              awk -F'\t' 'BEGIN{srand()}{print  $0 "\t" rand() }' |
              sort -t "$(printf '\t')" -k2n -k3n -k5n |
              awk '/^[^#]/{print "http://"; $1 ":" $4}'
        )
        for proxy in $result; do
            log_debug "Testing proxy $proxy"
            if hit "$proxy" | grep -q -i 'HTTP.*406'; then
                log_debug "Successfully tested $proxy"
                set_proxy "${proxy}"
                return 0
            else
                log_debug "Error while testing $proxy"
            fi
        done

# ...

```

This should handle the SRV records priority, weight, shuffle records with the same priority and weight, test them in order and select the first one that works, while not setting a proxy if none work.

Note that I have not tested thoroughly my code for security vulnerabilities. I still hope this code snippet can be useful for someone.

Best Regards

On 14/11/2026 22:08, samy wrote:
Package: auto-apt-proxy
Version: 14.1
Severity: normal
X-Debbugs-Cc:[email protected]

Dear Maintainer,

I am trying to setup an apt cache for my servers. Ideally, they would check the 
cache server, and if it is unavailable, directly download packages from 
official mirrors.
In most cases, auto-apt-proxy should handle that since it check if the server 
is running. However, when setting the srv dns record, it does not. The comments 
in the code reason that it does not need to guess that it is a correct caching 
server, but the possibility of checking if the server is up to potentially fall 
back on an other does not seem do have been considered.

I would appreciate if this beheaviour could be changed.

Please note that while I am reporting for an old version of the package, the 
beheaviour is still present in its latest version.

Best regards


-- System Information:
Debian Release: 12.15
   APT prefers oldstable-updates
   APT policy: (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 
'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 7.0.14-20-pve (SMP w/1 CPU thread; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages auto-apt-proxy depends on:
ii  apt  2.6.2

Versions of packages auto-apt-proxy recommends:
ii  iproute2  6.1.0-3

auto-apt-proxy suggests no packages.

-- no debconf information

Reply via email to