fix(apt_proxy): https sources take the http proxy too (NetOrk/netork#1811) #64

Merged
christianmanivong merged 3 commits from fix/apt-https-proxy into main 2026-11-01 07:25:56 +00:00
Owner

Prio: P2 (NetOrk/netork#1811)

apt's https method asks Acquire::https::Proxy first and then Acquire::http::Proxy, for the host and then for all. This was measured with apt 2.8.3's apt-helper against a dead port and against a proxy that answers 403. An 00proxy with the http line alone therefore sent download.docker.com and every other https source to apt-cacher-ng. Without a PassThroughPattern the cache answers 403 CONNECT denied, and the whole upgrade failed.

  • Report: carries https_proxy, https_per_host and https_settings. https_proxy_for(report, host) is the proxy apt takes for one https host.

  • check_https_source(): fetches one https source's InRelease the way apt does. It returns None where no https source goes through a proxy.

  • configure_package_proxy: gains an https step, which fetches one https source through the new proxy. Where the proxy refuses it:

    • 00proxy also gets Acquire::https::Proxy "DIRECT";;
    • later https lines to the same proxy are commented out;
    • the source is fetched again, directly.

    An HTTP error from the mirror counts as let through.

  • Helpers: apt_fetch_command takes https URLs, and comment_out_command takes a scheme.

Checked against real apt on a noble host: check_https_source() sees the http proxy as the https one and reports 403 CONNECT denied from a proxy that refuses CONNECT.

napalm-linux needs NAPALM/napalm-linux (fix/apt-https-step): one of its tests listed the fix's steps exactly. Merge this one first or together.

Prio: P2 (NetOrk/netork#1811) apt's https method asks `Acquire::https::Proxy` first and then `Acquire::http::Proxy`, for the host and then for all. This was measured with apt 2.8.3's `apt-helper` against a dead port and against a proxy that answers 403. An `00proxy` with the http line alone therefore sent download.docker.com and every other https source to apt-cacher-ng. Without a `PassThroughPattern` the cache answers `403 CONNECT denied`, and the whole upgrade failed. - **Report:** carries `https_proxy`, `https_per_host` and `https_settings`. `https_proxy_for(report, host)` is the proxy apt takes for one https host. - **`check_https_source()`:** fetches one https source's `InRelease` the way apt does. It returns None where no https source goes through a proxy. - **`configure_package_proxy`:** gains an `https` step, which fetches one https source through the new proxy. Where the proxy refuses it: - `00proxy` also gets `Acquire::https::Proxy "DIRECT";`; - later https lines to the same proxy are commented out; - the source is fetched again, directly. An HTTP error from the mirror counts as let through. - **Helpers:** `apt_fetch_command` takes https URLs, and `comment_out_command` takes a `scheme`. Checked against real apt on a noble host: `check_https_source()` sees the http proxy as the https one and reports `403 CONNECT denied` from a proxy that refuses CONNECT. napalm-linux needs NAPALM/napalm-linux (fix/apt-https-step): one of its tests listed the fix's steps exactly. Merge this one first or together.
christianmanivong added 1 commit 2026-11-01 06:59:13 +00:00
fix(apt_proxy): https sources take the http proxy too (NetOrk/netork#1811)
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Failing after 18s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m7s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Failing after 2m22s
driver / publish (pull_request) Skipped
3b6c5f9585
apt's https method asks Acquire::https::Proxy and then Acquire::http::Proxy,
for the host and then for all. An 00proxy with the http line alone therefore
sent download.docker.com and every other https source to apt-cacher-ng, which
answers 403 CONNECT denied without a PassThroughPattern, and the whole upgrade
failed.

- The report carries https_proxy, https_per_host and https_settings;
  https_proxy_for(report, host) is the proxy apt takes for one https host.
- check_https_source() fetches one https source the way apt does.
- configure_package_proxy gains an https step: one https source through the
  new proxy. Where the proxy refuses it, 00proxy also says
  Acquire::https::Proxy "DIRECT", later https lines to the same proxy are
  commented out, and the source is fetched direct. An HTTP error from the
  mirror counts as let through.
- apt_fetch_command takes https URLs; comment_out_command takes a scheme.
christianmanivong added 1 commit 2026-11-01 07:13:20 +00:00
refactor(apt_proxy): smaller parts, under the standard's complexity limit
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Failing after 20s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 47s
driver / build (pull_request) Successful in 55s
driver / security (pull_request) Successful in 1m33s
CI / driver (pull_request) Failing after 3m0s
driver / publish (pull_request) Skipped
c71ddd7fe6
The quality ratchet counted _dump, parse_apt_proxy and _https_direct over
complexity 10 (NetOrk/netork#1811). Same behaviour, same tests.
christianmanivong added 1 commit 2026-11-01 07:21:23 +00:00
Merge remote-tracking branch 'origin/main' into fix/apt-https-proxy
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / test (3.13) (pull_request) Successful in 1m0s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m50s
driver / publish (pull_request) Skipped
86959b7599
christianmanivong merged commit 25cc264306 into main 2026-11-01 07:25:56 +00:00
christianmanivong deleted branch fix/apt-https-proxy 2026-11-01 07:25:56 +00:00
Sign in to join this conversation.