[evolution/gnome-3-32] M!12 - [SRV config lookup] Do not write default ports in CalDAV/CardDAV URLs



commit 24a40bfa01c0bbbaf79f852f26bbf87218d90116
Author: Дилян Палаузов <git-dpa aegee org>
Date:   Tue Apr 23 21:42:02 2019 +0200

    M!12 - [SRV config lookup] Do not write default ports in CalDAV/CardDAV URLs
    
    Closes https://gitlab.gnome.org/GNOME/evolution/merge_requests/12

 src/modules/config-lookup/e-srv-config-lookup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/modules/config-lookup/e-srv-config-lookup.c b/src/modules/config-lookup/e-srv-config-lookup.c
index 669e3f356a..fe4c11407d 100644
--- a/src/modules/config-lookup/e-srv-config-lookup.c
+++ b/src/modules/config-lookup/e-srv-config-lookup.c
@@ -181,11 +181,14 @@ srv_config_lookup_domain_sync (EConfigLookup *config_lookup,
                                        e_config_lookup_result_simple_add_string (lookup_result, 
extension_name, "user", email_address);
                                } else if (known_services[ii].kind == E_CONFIG_LOOKUP_RESULT_COLLECTION) {
                                        gboolean is_calendar = g_str_equal (known_services[ii].evo_protocol, 
"caldav");
+                                       gboolean is_secure = g_str_has_suffix 
(known_services[ii].gio_protocol, "s");
+                                       guint16 port = g_srv_target_get_port (target);
                                        gchar *url;
 
-                                       url = g_strdup_printf ("%s://%s:%d",
-                                               g_str_has_suffix (known_services[ii].gio_protocol, "s") ? 
"https" : "http",
-                                               hostname, g_srv_target_get_port (target));
+                                       if ((!is_secure && port == 80) || (is_secure && port == 443))
+                                               url = g_strdup_printf ("http%s://%s", is_secure ? "s" : "", 
hostname);
+                                       else
+                                               url = g_strdup_printf ("http%s://%s:%d", is_secure ? "s" : 
"", hostname, port);
 
                                        e_config_lookup_result_simple_add_string (lookup_result, 
E_SOURCE_EXTENSION_COLLECTION,
                                                "backend-name", "webdav");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]