Bug 38277 - Проблема запуска apt-get через прокси сервер
Summary: Проблема запуска apt-get через прокси сервер
Status: RESOLVED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: apt (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Ivan Zakharyaschev
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-25 15:12 MSK by pav@altlinux.org
Modified: 2025-04-24 10:32 MSK (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pav@altlinux.org 2020-03-25 15:12:59 MSK
Проблема подключения через прокси сервер заключается в некорректном парсинге строк из файла /etc/apt/apt.conf или переменной окружения http_proxy, когда устанавливаемый пароль содержит символ @(0x40)

Предусматривается использование в формате
Acquire::http::Proxy "http://[user[:pass]@]host[:port]/";

Если в /etc/apt/apt.conf установлены параметры
Acquire::http::proxy "test:P@ssw0rd@10.0.5.213:3128/";
или установлена переменная http_proxy=http://test:P@ssw0rd@10.0.5.213:3128/
выдается ошибка
# apt-get update
Ошибка http://mirror.yandex.ru p9/branch/x86_64 release
  Could not resolve 'ssw0rd@10.0.5.213'
Ошибка http://mirror.yandex.ru p9/branch/x86_64-i586 release
  Could not resolve 'ssw0rd@10.0.5.213'

Замена символа @ на %40, также как использование \@, результата не дает.

По аналогии проблема может также касаться записей
Acquire::ftp::Proxy "ftp://[user[:pass]@]host[:port]/";
Acquire::rsync::proxy="[user[:pass]@]host[:port]";
Comment 1 pav@altlinux.org 2020-03-25 16:59:03 MSK
В /etc/apt/apt.conf прописано - 
Acquire::http::proxy "http://test:P@ssw0rd@10.0.5.213:3128/" вместо  "test:P@ssw0rd@10.0.5.213:3128/"
Comment 2 Andrey Cherepanov 2020-03-25 17:47:23 MSK
apt/apt-pkg/contrib/strutl.cc +1063
Comment 3 Andrey Cherepanov 2025-04-09 15:15:33 MSK
ping
Comment 4 Ivan Zakharyaschev 2025-04-09 15:48:52 MSK
(In reply to Andrey Cherepanov from comment #3)
> ping

проверю и исправлю в ближайшем релизе с HTTPS over http_proxy (хочу сегодня отправить в Sisyphus), спасибо за напоминание!
Comment 5 Repository Robot 2025-04-24 10:32:29 MSK
apt-0.5.15lorg2-alt92 -> sisyphus:

 Wed Apr 16 2025 Ivan Zakharyaschev <imz@altlinux> 0.5.15lorg2-alt92
 - Support encoded usernames and passwords in URIs (incl. http_proxy); it was
   impossible to have @ there; now one should write %40 (ALT#38277).
 - Get config values with percent (%) correct in methods (e.g., a password as
   above in Acquire::http::Proxy). More generally: for correct decoding,
   do always encode percent (%) when %-encoding strings (in any URIs etc).
 - Backported the fixes from Debian 0.9.8~3 (IPv6 literals; encode passwords):
   + properly escape IP-literals (e.g. IPv6 address) in HTTP requests
     (allows using IPv6 numeric addresses in sources.list) (ALT#34000);
   + %-encode username and password when writing URIs (doesn't help alone with
     reading URIs as in the case of http_proxy above, but normalizes output);
   + include port in shortened URIs (e.g. with apt-cache policy).
 - testcases: Multiplied http-related ones to test these kinds of connections.
 - Some HTTP tweaks from Debian:
   + quote spaces ( ) and plus (+) in filenames (0.9.8~48);
   + do not send keep-alive (HTTP/1.1 default) (0.9.9.3~4^2).