summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2023-01-31 13:29:41 +0100
committerMilan Crha <mcrha@redhat.com>2023-01-31 13:33:20 +0100
commit4bb9f095ecb3f189af956f300b50258746733937 (patch)
treeda2ea256e4abd59eb10ad1527aa36e50d8ae4fc7
parent97919d6dc97aa9cf0ff289135da5b39930a6a0d7 (diff)
downloadevolution-data-server-4bb9f095ecb3f189af956f300b50258746733937.tar.gz
Parse URI strings into GUri in a relaxed mode
The provided URI strings can be sometimes incorrectly constructed, like an `@` in the user name part not being encoded, which causes incorrect parse into the GUri without the relaxed mode (it stops parsing the user information on the first `@`, not the second), leading into an incorrect host name. Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/2228
-rw-r--r--src/libedataserver/e-soup-session.c4
-rw-r--r--src/libedataserver/e-webdav-discover.c2
-rw-r--r--src/libedataserver/e-webdav-session.c2
-rw-r--r--src/libedataserverui/e-credentials-prompter-impl-oauth2.c2
-rw-r--r--src/libedataserverui/e-trust-prompt.c2
-rw-r--r--src/libedataserverui/e-webdav-discover-widget.c2
-rw-r--r--src/modules/gnome-online-accounts/module-gnome-online-accounts.c2
-rw-r--r--src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c2
8 files changed, 9 insertions, 9 deletions
diff --git a/src/libedataserver/e-soup-session.c b/src/libedataserver/e-soup-session.c
index f6645aea6..458d69927 100644
--- a/src/libedataserver/e-soup-session.c
+++ b/src/libedataserver/e-soup-session.c
@@ -994,7 +994,7 @@ e_soup_session_new_message (ESoupSession *session,
g_return_val_if_fail (E_IS_SOUP_SESSION (session), NULL);
- uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, error);
+ uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, error);
if (!uri)
return NULL;
@@ -1658,7 +1658,7 @@ e_soup_session_send_message_sync (ESoupSession *session,
if (new_location) {
GUri *new_uri;
- new_uri = g_uri_parse_relative (soup_message_get_uri (message), new_location, SOUP_HTTP_URI_FLAGS, NULL);
+ new_uri = g_uri_parse_relative (soup_message_get_uri (message), new_location, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
soup_message_set_uri (message, new_uri);
diff --git a/src/libedataserver/e-webdav-discover.c b/src/libedataserver/e-webdav-discover.c
index 189467fda..51e816519 100644
--- a/src/libedataserver/e-webdav-discover.c
+++ b/src/libedataserver/e-webdav-discover.c
@@ -876,7 +876,7 @@ e_webdav_discover_sources_full_sync (ESource *source,
if (url_use_path && (g_ascii_strncasecmp (url_use_path, "http://", 7) == 0 ||
g_ascii_strncasecmp (url_use_path, "https://", 8) == 0)) {
- guri = g_uri_parse (url_use_path, SOUP_HTTP_URI_FLAGS, NULL);
+ guri = g_uri_parse (url_use_path, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
url_use_path = NULL;
} else {
g_return_val_if_fail (e_source_has_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND), FALSE);
diff --git a/src/libedataserver/e-webdav-session.c b/src/libedataserver/e-webdav-session.c
index 303af718e..4ee8414ef 100644
--- a/src/libedataserver/e-webdav-session.c
+++ b/src/libedataserver/e-webdav-session.c
@@ -1934,7 +1934,7 @@ e_webdav_session_extract_href_and_etag (SoupMessage *message,
if (header) {
GUri *uri;
- uri = g_uri_parse_relative (soup_message_get_uri (message), header, SOUP_HTTP_URI_FLAGS, NULL);
+ uri = g_uri_parse_relative (soup_message_get_uri (message), header, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (uri && g_uri_get_host (uri))
*out_href = g_uri_to_string_partial (uri, G_URI_HIDE_PASSWORD);
diff --git a/src/libedataserverui/e-credentials-prompter-impl-oauth2.c b/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
index 2415947c3..289d0c6d1 100644
--- a/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
+++ b/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
@@ -96,7 +96,7 @@ cpi_oauth2_create_auth_uri (EOAuth2Service *service,
g_return_val_if_fail (E_IS_OAUTH2_SERVICE (service), NULL);
g_return_val_if_fail (E_IS_SOURCE (source), NULL);
- parsed_uri = g_uri_parse (e_oauth2_service_get_authentication_uri (service, source), SOUP_HTTP_URI_FLAGS, NULL);
+ parsed_uri = g_uri_parse (e_oauth2_service_get_authentication_uri (service, source), SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
g_return_val_if_fail (parsed_uri != NULL, NULL);
uri_query = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
diff --git a/src/libedataserverui/e-trust-prompt.c b/src/libedataserverui/e-trust-prompt.c
index a6caf1418..f37c46142 100644
--- a/src/libedataserverui/e-trust-prompt.c
+++ b/src/libedataserverui/e-trust-prompt.c
@@ -467,7 +467,7 @@ trust_prompt_get_host_from_url (const gchar *url)
if (!url || !*url)
return NULL;
- suri = g_uri_parse (url, SOUP_HTTP_URI_FLAGS, NULL);
+ suri = g_uri_parse (url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (!suri)
return NULL;
diff --git a/src/libedataserverui/e-webdav-discover-widget.c b/src/libedataserverui/e-webdav-discover-widget.c
index 95315b4a1..683a6c75a 100644
--- a/src/libedataserverui/e-webdav-discover-widget.c
+++ b/src/libedataserverui/e-webdav-discover-widget.c
@@ -883,7 +883,7 @@ e_webdav_discover_content_refresh (GtkWidget *content,
use_cancellable = cancellable ? g_object_ref (cancellable) : g_cancellable_new ();
task = g_task_new (self, use_cancellable, callback, user_data);
g_task_set_source_tag (task, e_webdav_discover_content_refresh);
- parsed_uri = g_uri_parse (self->base_url, SOUP_HTTP_URI_FLAGS, NULL);
+ parsed_uri = g_uri_parse (self->base_url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
if (!parsed_uri) {
g_task_return_new_error (task,
G_IO_ERROR,
diff --git a/src/modules/gnome-online-accounts/module-gnome-online-accounts.c b/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
index 0831d54a1..5041f27c4 100644
--- a/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
+++ b/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
@@ -288,7 +288,7 @@ goa_ews_autodiscover_done_cb (GObject *source_object,
user = goa_account_dup_identity (goa_account);
email = goa_account_dup_presentation_identity (goa_account);
- suri = g_uri_parse (as_url, SOUP_HTTP_URI_FLAGS, NULL);
+ suri = g_uri_parse (as_url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
g_object_set (
source_extension,
diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c b/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
index a2998f68f..48466f031 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
@@ -2780,7 +2780,7 @@ migrate_parse_source (ParseData *parse_data,
uri_string = g_strconcat (
parse_data->base_uri, "/", relative_uri, NULL);
- parse_data->parsed_uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, NULL);
+ parse_data->parsed_uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
/* Mangle the URI to not contain invalid characters. We'll need
* this later to rename the source's cache and data directories. */