Remove support for ftp_proxy

Was limited to HTTP proxy servers and prevents simplifying and fixing
HTTP proxy support.
This commit is contained in:
Chris Mayo 2021-12-13 19:25:23 +00:00
parent f2e5a435e3
commit a60648e348
6 changed files with 11 additions and 42 deletions

View file

@ -51,7 +51,6 @@ according to the URL scheme.
"1" -> "13" [arrowhead="empty", arrowtail="none"];
"2" -> "13" [arrowhead="empty", arrowtail="none"];
"3" -> "6" [arrowhead="empty", arrowtail="none"];
"3" -> "10" [arrowhead="empty", arrowtail="none"];
"4" -> "6" [arrowhead="empty", arrowtail="none"];
"4" -> "10" [arrowhead="empty", arrowtail="none"];
"5" -> "12" [arrowhead="empty", arrowtail="none"];

View file

@ -325,9 +325,9 @@ and one to all URLs starting with **https://example.org/**:
PROXY SUPPORT
-------------
To use a proxy on Unix or Windows set the :envvar:`http_proxy`, :envvar:`https_proxy` or
:envvar:`ftp_proxy` environment variables to the proxy URL. The URL should be of
the form
To use a proxy on Unix or Windows set the :envvar:`http_proxy` or
:envvar:`https_proxy` environment variables to the proxy URL. The URL should be
of the form
**http://**\ [*user*\ **:**\ *pass*\ **@**]\ *host*\ [**:**\ *port*].
LinkChecker also detects manual proxy settings of Internet Explorer
under Windows systems, and GNOME or KDE on Linux systems. On a Mac use

View file

@ -5,6 +5,8 @@ Migrating from 10.0 to 10.x
If installing from source and application translations are needed the Python
polib package is required to be installed before LinkChecker is installed.
The environment variable ftp_proxy is no longer supported.
Migrating from 9.x to 10.0
--------------------------
Python 3.6 or newer is required.

View file

@ -21,11 +21,11 @@ import ftplib
from io import StringIO
from .. import log, LOG_CHECK, LinkCheckerError, mimeutil
from . import proxysupport, httpurl, internpaturl, get_index_html
from . import internpaturl, get_index_html
from .const import WARN_FTP_MISSING_SLASH
class FtpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
class FtpUrl(internpaturl.InternPatternUrl):
"""
Url link with ftp scheme.
"""
@ -43,25 +43,8 @@ class FtpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
def check_connection(self):
"""
In case of proxy, delegate to HttpUrl. Else check in this
order: login, changing directory, list the file.
Check in this order: login, changing directory, list the file.
"""
# proxy support (we support only http)
self.set_proxy(self.aggregate.config["proxy"].get(self.scheme))
if self.proxy:
# using a (HTTP) proxy
http = httpurl.HttpUrl(
self.base_url,
self.recursion_level,
self.aggregate,
parent_url=self.parent_url,
base_ref=self.base_ref,
line=self.line,
column=self.column,
name=self.name,
)
http.build_url()
return http.check()
self.login()
self.negotiate_encoding()
self.filename = self.cwd()

View file

@ -333,10 +333,6 @@ class Configuration(dict):
http_proxy = get_gnome_proxy() or get_kde_http_proxy()
if http_proxy:
self["proxy"]["http"] = http_proxy
if "ftp" not in self["proxy"]:
ftp_proxy = get_gnome_proxy(protocol="FTP") or get_kde_ftp_proxy()
if ftp_proxy:
self["proxy"]["ftp"] = ftp_proxy
def sanitize_plugins(self):
"""Ensure each plugin is configurable."""
@ -482,15 +478,6 @@ def get_kde_http_proxy():
log.debug(LOG_CHECK, "error getting HTTP proxy from KDE: %s", msg)
def get_kde_ftp_proxy():
"""Return host:port for KDE HTTP proxy if found, else None."""
try:
data = read_kioslaverc()
return data.get("ftp_proxy")
except Exception as msg:
log.debug(LOG_CHECK, "error getting FTP proxy from KDE: %s", msg)
# The following KDE functions are largely ported and ajusted from
# Google Chromium:
# http://src.chromium.org/viewvc/chrome/trunk/src/net/proxy/proxy_config_service_linux.cc?revision=HEAD&view=markup
@ -610,8 +597,6 @@ def add_kde_setting(key, value, data):
add_kde_proxy("http_proxy", value, data)
elif key == "httpsProxy":
add_kde_proxy("https_proxy", value, data)
elif key == "ftpProxy":
add_kde_proxy("ftp_proxy", value, data)
elif key == "ReversedException":
if value == "true":
value = True
@ -650,13 +635,13 @@ def resolve_kde_settings(data):
if "mode" not in data:
return
if data["mode"] == "indirect":
for key in ("http_proxy", "https_proxy", "ftp_proxy"):
for key in ("http_proxy", "https_proxy"):
if key in data:
resolve_indirect(data, key)
if "ignore_hosts" in data:
resolve_indirect(data, "ignore_hosts", splithosts=True)
elif data["mode"] != "manual":
# unsupported config
for key in ("http_proxy", "https_proxy", "ftp_proxy"):
for key in ("http_proxy", "https_proxy"):
if key in data:
del data[key]

View file

@ -105,7 +105,7 @@ def print_env_info(key, out=stderr):
def print_proxy_info(out=stderr):
"""Print proxy info."""
for key in ("http_proxy", "ftp_proxy", "no_proxy"):
for key in ("http_proxy", "no_proxy"):
print_env_info(key, out=out)