1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 22:06:38 +02:00

script: remove option script.scripts.url_force_https, use HTTPS by default in option script.scripts.url (issue #253)

This commit is contained in:
Sébastien Helleu
2017-04-23 14:11:27 +02:00
parent ffdf0ec687
commit 2606b8a5a3
23 changed files with 141 additions and 227 deletions
+2 -12
View File
@@ -86,7 +86,6 @@ struct t_config_option *script_config_scripts_download_timeout;
struct t_config_option *script_config_scripts_path;
struct t_config_option *script_config_scripts_hold;
struct t_config_option *script_config_scripts_url;
struct t_config_option *script_config_scripts_url_force_https;
/*
@@ -760,17 +759,8 @@ script_config_init ()
script_config_scripts_url = weechat_config_new_option (
script_config_file, ptr_section,
"url", "string",
N_("URL for file with list of scripts; by default HTTPS is forced, "
"see option script.scripts.url_force_https"),
NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_url_force_https = weechat_config_new_option (
script_config_file, ptr_section,
"url_force_https", "boolean",
N_("force use of HTTPS for downloads (index and scripts); "
"you should disable this option only if you have problems with "
"the downloads"),
NULL, 0, 0, "on", NULL, 0,
N_("URL for file with list of scripts"),
NULL, 0, 0, "https://weechat.org/files/plugins.xml.gz", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
-1
View File
@@ -66,7 +66,6 @@ extern struct t_config_option *script_config_scripts_download_timeout;
extern struct t_config_option *script_config_scripts_path;
extern struct t_config_option *script_config_scripts_hold;
extern struct t_config_option *script_config_scripts_url;
extern struct t_config_option *script_config_scripts_url_force_https;
extern const char *script_config_get_diff_command ();
extern char *script_config_get_xml_filename ();
+3 -14
View File
@@ -100,9 +100,6 @@ script_language_search_by_extension (const char *extension)
/*
* Builds download URL (to use with hook_process or hook_process_hashtable).
*
* If the option script.scripts.url_force_https is enabled, the protocol is
* forced to HTTPS (if URL starts with "http://").
*
* Note: result must be freed after use.
*/
@@ -115,21 +112,13 @@ script_build_download_url (const char *url)
if (!url || !url[0])
return NULL;
/* length of url + "url:" + 1 (for httpS) */
length = 4 + 1 + strlen (url) + 1;
/* length of url + "url:" */
length = 4 + strlen (url) + 1;
result = malloc (length);
if (!result)
return NULL;
if (weechat_config_boolean (script_config_scripts_url_force_https)
&& (weechat_strncasecmp (url, "http://", 7) == 0))
{
snprintf (result, length, "url:https://%s", url + 7);
}
else
{
snprintf (result, length, "url:%s", url);
}
snprintf (result, length, "url:%s", url);
return result;
}