[gnome-calendar/mcatanzaro/webcal: 18/18] 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: 18/18] source-discoverer: add support for webcal:// URIs
- Date: Tue, 14 Apr 2020 19:48:04 +0000 (UTC)
commit a9f8cd415f8339a0d83f99f4345f243588a8af5f
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 | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/utils/gcal-source-discoverer.c b/src/utils/gcal-source-discoverer.c
index 6c61cdab..b6671d31 100644
--- a/src/utils/gcal-source-discoverer.c
+++ b/src/utils/gcal-source-discoverer.c
@@ -216,16 +216,24 @@ 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 gchar *uri_str = NULL;
const gchar *content_type;
GCAL_ENTRY;
- GCAL_TRACE_MSG ("Creating request for %s", data->uri);
+ uri = soup_uri_new (data->uri);
+
+ 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]