mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-02 20:04:43 +00:00
Remove support for ftp_proxy
Was limited to HTTP proxy servers and prevents simplifying and fixing HTTP proxy support.
This commit is contained in:
parent
f2e5a435e3
commit
a60648e348
6 changed files with 11 additions and 42 deletions
|
|
@ -51,7 +51,6 @@ according to the URL scheme.
|
||||||
"1" -> "13" [arrowhead="empty", arrowtail="none"];
|
"1" -> "13" [arrowhead="empty", arrowtail="none"];
|
||||||
"2" -> "13" [arrowhead="empty", arrowtail="none"];
|
"2" -> "13" [arrowhead="empty", arrowtail="none"];
|
||||||
"3" -> "6" [arrowhead="empty", arrowtail="none"];
|
"3" -> "6" [arrowhead="empty", arrowtail="none"];
|
||||||
"3" -> "10" [arrowhead="empty", arrowtail="none"];
|
|
||||||
"4" -> "6" [arrowhead="empty", arrowtail="none"];
|
"4" -> "6" [arrowhead="empty", arrowtail="none"];
|
||||||
"4" -> "10" [arrowhead="empty", arrowtail="none"];
|
"4" -> "10" [arrowhead="empty", arrowtail="none"];
|
||||||
"5" -> "12" [arrowhead="empty", arrowtail="none"];
|
"5" -> "12" [arrowhead="empty", arrowtail="none"];
|
||||||
|
|
|
||||||
|
|
@ -325,9 +325,9 @@ and one to all URLs starting with **https://example.org/**:
|
||||||
PROXY SUPPORT
|
PROXY SUPPORT
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
To use a proxy on Unix or Windows set the :envvar:`http_proxy`, :envvar:`https_proxy` or
|
To use a proxy on Unix or Windows set the :envvar:`http_proxy` or
|
||||||
:envvar:`ftp_proxy` environment variables to the proxy URL. The URL should be of
|
:envvar:`https_proxy` environment variables to the proxy URL. The URL should be
|
||||||
the form
|
of the form
|
||||||
**http://**\ [*user*\ **:**\ *pass*\ **@**]\ *host*\ [**:**\ *port*].
|
**http://**\ [*user*\ **:**\ *pass*\ **@**]\ *host*\ [**:**\ *port*].
|
||||||
LinkChecker also detects manual proxy settings of Internet Explorer
|
LinkChecker also detects manual proxy settings of Internet Explorer
|
||||||
under Windows systems, and GNOME or KDE on Linux systems. On a Mac use
|
under Windows systems, and GNOME or KDE on Linux systems. On a Mac use
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ Migrating from 10.0 to 10.x
|
||||||
If installing from source and application translations are needed the Python
|
If installing from source and application translations are needed the Python
|
||||||
polib package is required to be installed before LinkChecker is installed.
|
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
|
Migrating from 9.x to 10.0
|
||||||
--------------------------
|
--------------------------
|
||||||
Python 3.6 or newer is required.
|
Python 3.6 or newer is required.
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ import ftplib
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from .. import log, LOG_CHECK, LinkCheckerError, mimeutil
|
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
|
from .const import WARN_FTP_MISSING_SLASH
|
||||||
|
|
||||||
|
|
||||||
class FtpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
class FtpUrl(internpaturl.InternPatternUrl):
|
||||||
"""
|
"""
|
||||||
Url link with ftp scheme.
|
Url link with ftp scheme.
|
||||||
"""
|
"""
|
||||||
|
|
@ -43,25 +43,8 @@ class FtpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
||||||
|
|
||||||
def check_connection(self):
|
def check_connection(self):
|
||||||
"""
|
"""
|
||||||
In case of proxy, delegate to HttpUrl. Else check in this
|
Check in this order: login, changing directory, list the file.
|
||||||
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.login()
|
||||||
self.negotiate_encoding()
|
self.negotiate_encoding()
|
||||||
self.filename = self.cwd()
|
self.filename = self.cwd()
|
||||||
|
|
|
||||||
|
|
@ -333,10 +333,6 @@ class Configuration(dict):
|
||||||
http_proxy = get_gnome_proxy() or get_kde_http_proxy()
|
http_proxy = get_gnome_proxy() or get_kde_http_proxy()
|
||||||
if http_proxy:
|
if http_proxy:
|
||||||
self["proxy"]["http"] = 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):
|
def sanitize_plugins(self):
|
||||||
"""Ensure each plugin is configurable."""
|
"""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)
|
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
|
# The following KDE functions are largely ported and ajusted from
|
||||||
# Google Chromium:
|
# Google Chromium:
|
||||||
# http://src.chromium.org/viewvc/chrome/trunk/src/net/proxy/proxy_config_service_linux.cc?revision=HEAD&view=markup
|
# 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)
|
add_kde_proxy("http_proxy", value, data)
|
||||||
elif key == "httpsProxy":
|
elif key == "httpsProxy":
|
||||||
add_kde_proxy("https_proxy", value, data)
|
add_kde_proxy("https_proxy", value, data)
|
||||||
elif key == "ftpProxy":
|
|
||||||
add_kde_proxy("ftp_proxy", value, data)
|
|
||||||
elif key == "ReversedException":
|
elif key == "ReversedException":
|
||||||
if value == "true":
|
if value == "true":
|
||||||
value = True
|
value = True
|
||||||
|
|
@ -650,13 +635,13 @@ def resolve_kde_settings(data):
|
||||||
if "mode" not in data:
|
if "mode" not in data:
|
||||||
return
|
return
|
||||||
if data["mode"] == "indirect":
|
if data["mode"] == "indirect":
|
||||||
for key in ("http_proxy", "https_proxy", "ftp_proxy"):
|
for key in ("http_proxy", "https_proxy"):
|
||||||
if key in data:
|
if key in data:
|
||||||
resolve_indirect(data, key)
|
resolve_indirect(data, key)
|
||||||
if "ignore_hosts" in data:
|
if "ignore_hosts" in data:
|
||||||
resolve_indirect(data, "ignore_hosts", splithosts=True)
|
resolve_indirect(data, "ignore_hosts", splithosts=True)
|
||||||
elif data["mode"] != "manual":
|
elif data["mode"] != "manual":
|
||||||
# unsupported config
|
# unsupported config
|
||||||
for key in ("http_proxy", "https_proxy", "ftp_proxy"):
|
for key in ("http_proxy", "https_proxy"):
|
||||||
if key in data:
|
if key in data:
|
||||||
del data[key]
|
del data[key]
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ def print_env_info(key, out=stderr):
|
||||||
|
|
||||||
def print_proxy_info(out=stderr):
|
def print_proxy_info(out=stderr):
|
||||||
"""Print proxy info."""
|
"""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)
|
print_env_info(key, out=out)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue