[gnome-calendar/mcatanzaro/webcal] source-discoverer: add support for webcal:// URIs
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/mcatanzaro/webcal] source-discoverer: add support for webcal:// URIs
- Date: Thu, 2 Apr 2020 22:40:24 +0000 (UTC)
commit 4990adc578f447c468239fb9022313c7bde4562c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Apr 2 17:39:22 2020 -0500
source-discoverer: add support for webcal:// URIs
We can implement webcal:// by simply rewriting the URI to https://.
Amazing!
Fixes #564
src/utils/gcal-source-discoverer.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/utils/gcal-source-discoverer.c b/src/utils/gcal-source-discoverer.c
index 6c61cdab..1bcca5bd 100644
--- a/src/utils/gcal-source-discoverer.c
+++ b/src/utils/gcal-source-discoverer.c
@@ -216,16 +216,29 @@ discover_file_in_thread (DiscovererData *data,
g_autoptr (SoupMessage) message = NULL;
g_autoptr (SoupSession) session = NULL;
g_autoptr (GPtrArray) source = NULL;
+ g_autoptr (SoupURI) uri = NULL;
+ g_autofree char *uri_str = NULL;
const gchar *content_type;
GCAL_ENTRY;
- GCAL_TRACE_MSG ("Creating request for %s", data->uri);
+ uri = soup_uri_new (data->uri);
+
+ /* Support webcal:// links by converting them to https://.
+ *
+ * We don't allow hidden use of http://, since we want to protect the
+ * user from accidentally leaking calendars in the clear.
+ */
+ if (strcmp (uri->scheme, "webcal") == 0)
+ soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
+
+ uri_str = soup_uri_to_string (uri, FALSE);
+ GCAL_TRACE_MSG ("Creating request for %s", uri_str);
session = soup_session_new_with_options (SOUP_SESSION_TIMEOUT, 10, NULL);
g_signal_connect (session, "authenticate", G_CALLBACK (on_soup_session_authenticate_cb), data);
- message = soup_message_new ("GET", data->uri);
+ message = soup_message_new_from_uri ("GET", uri);
input_stream = soup_session_send (session, message, cancellable, error);
if (!input_stream)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]