hplip/hplip-curl-fallback.patch

40 lines
2.2 KiB
Diff

diff --git a/installer/pluginhandler.py b/installer/pluginhandler.py
index c2e2a94..d10d1b9 100755
--- a/installer/pluginhandler.py
+++ b/installer/pluginhandler.py
@@ -36,7 +36,7 @@ def get_checksum(s):
PLUGIN_STATE_FILE = '/var/lib/hp/hplip.state'
-PLUGIN_FALLBACK_LOCATION = 'https://developers.hp.com/sites/default/files/'
+PLUGIN_FALLBACK_LOCATION = 'https://developers.hp.com/sites/default/files/2026-05/'
@@ -281,7 +281,7 @@ class PluginHandle(object):
else:
curl = utils.which("curl", True)
if curl:
- cmd = "%s --create-dirs -O --output-dir %s --location %s" % (curl,self.__plugin_path,src)
+ cmd = "%s -f --create-dirs -O --output-dir %s --location %s" % (curl,self.__plugin_path,src)
log.debug(cmd)
status, output = utils.run(cmd)
log.debug("curl returned: %d" % status)
@@ -290,7 +290,7 @@ class PluginHandle(object):
if status != 0 or os_utils.getFileSize(plugin_file) <= 0:
src = os.path.join(PLUGIN_FALLBACK_LOCATION, self.__plugin_name)
log.info("Plugin is not accessible. Trying to download it from fallback location: [%s]" % src)
- cmd = "%s --create-dirs -O --output-dir %s --location %s" % (curl,self.__plugin_path,src)
+ cmd = "%s -f --user-agent 'Mozilla/5.0 (compatible; hplip-plugin/1.0)' --create-dirs -O --output-dir %s --location %s" % (curl,self.__plugin_path,src)
log.debug(cmd)
status, output = utils.run(cmd)
@@ -318,7 +318,7 @@ class PluginHandle(object):
if digsig_url.startswith('file://'):
status, filename = utils.download_from_network(digsig_url, digsig_file, True)
else:
- cmd = "%s --create-dirs -O --output-dir %s --location %s" % (curl, self.__plugin_path,digsig_url)
+ cmd = "%s -f --user-agent 'Mozilla/5.0 (compatible; hplip-plugin/1.0)' --create-dirs -O --output-dir %s --location %s" % (curl, self.__plugin_path,digsig_url)
log.debug(cmd)
status, output = utils.run(cmd)
except IOError as e: