[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-968-gd42f3d7e5
mones at claws-mail.org
mones at claws-mail.org
Sun Jun 21 19:44:44 CEST 2020
The branch, gtk3 has been updated
via d42f3d7e5f9e65d045be32a71c8a67e7de7a2591 (commit)
via a0cd23ecbb4ea8b3bc76568b47e8e9451678a2cb (commit)
from 00e802e57c96faa3ebf6a8cfca7e4c4a2c680343 (commit)
Summary of changes:
src/plugins/libravatar/libravatar_image.c | 12 +++++++++---
src/plugins/libravatar/libravatar_prefs.c | 9 +++++++++
src/plugins/libravatar/libravatar_prefs.h | 3 +++
3 files changed, 21 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit d42f3d7e5f9e65d045be32a71c8a67e7de7a2591
Author: Ricardo Mones <ricardo at mones.org>
Date: Sun Jun 21 19:41:40 2020 +0200
Fix bug 4220 "generates files in cache without content"
Also replace "safe" call, since file should not be locked and is
going to be deleted anyway.
diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
index b5675aac2..6d0fdac76 100644
--- a/src/plugins/libravatar/libravatar_image.c
+++ b/src/plugins/libravatar/libravatar_image.c
@@ -83,6 +83,7 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
curl = curl_easy_init();
if (curl == NULL) {
g_warning("could not initialize curl to get image from URL");
+ unlink(filename);
claws_fclose(file);
return NULL;
}
@@ -113,7 +114,8 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
debug_print("curl_easy_perfom failed: %s", curl_easy_strerror(res));
- claws_safe_fclose(file);
+ unlink(filename);
+ claws_fclose(file);
} else {
filesize = ftell(file);
claws_safe_fclose(file);
commit a0cd23ecbb4ea8b3bc76568b47e8e9451678a2cb
Author: Ricardo Mones <ricardo at mones.org>
Date: Sun Jun 21 19:40:59 2020 +0200
Fix bug 4325 "Following redirects when retrieving image"
Previously hardcoded numbers are now raised to cope with libravatar
servers changes and also moved into 3 new hidden preferences for the
plugin, for future customisation if required.
diff --git a/src/plugins/libravatar/libravatar_image.c b/src/plugins/libravatar/libravatar_image.c
index 057569a0f..b5675aac2 100644
--- a/src/plugins/libravatar/libravatar_image.c
+++ b/src/plugins/libravatar/libravatar_image.c
@@ -99,8 +99,12 @@ static GdkPixbuf *pixbuf_from_url(const gchar *url, const gchar *md5, const gcha
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
if (libravatarprefs.allow_redirects) {
- long maxredirs = (libravatarprefs.default_mode == DEF_MODE_URL)? 3L
- : ((libravatarprefs.default_mode == DEF_MODE_MM)? 2L: 1L);
+ long maxredirs = (libravatarprefs.default_mode == DEF_MODE_URL)
+ ? libravatarprefs.max_redirects_url
+ : ((libravatarprefs.default_mode == DEF_MODE_MM)
+ ? libravatarprefs.max_redirects_mm
+ : libravatarprefs.max_redirects_url);
+ debug_print("setting max redirects to %ld\n", maxredirs);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, maxredirs);
}
diff --git a/src/plugins/libravatar/libravatar_prefs.c b/src/plugins/libravatar/libravatar_prefs.c
index 5372395ca..5e8717323 100644
--- a/src/plugins/libravatar/libravatar_prefs.c
+++ b/src/plugins/libravatar/libravatar_prefs.c
@@ -93,6 +93,15 @@ static PrefParam param[] = {
{ "timeout", "0",
&libravatarprefs.timeout,
P_INT, NULL, NULL, NULL },
+ { "max_redirects_url", "7",
+ &libravatarprefs.max_redirects_url,
+ P_INT, NULL, NULL, NULL },
+ { "max_redirects_mm", "5",
+ &libravatarprefs.max_redirects_mm,
+ P_INT, NULL, NULL, NULL },
+ { "max_redirects", "3",
+ &libravatarprefs.max_redirects,
+ P_INT, NULL, NULL, NULL },
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
diff --git a/src/plugins/libravatar/libravatar_prefs.h b/src/plugins/libravatar/libravatar_prefs.h
index 49be9645d..2e4cb93c3 100644
--- a/src/plugins/libravatar/libravatar_prefs.h
+++ b/src/plugins/libravatar/libravatar_prefs.h
@@ -48,6 +48,9 @@ struct _LibravatarPrefs
gboolean allow_federated;
#endif
guint timeout;
+ guint max_redirects_url; /* hidden pref */
+ guint max_redirects_mm; /* hidden pref */
+ guint max_redirects; /* hidden pref */
};
extern LibravatarPrefs libravatarprefs;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list