From 43f73383a4b9eb041464146759249dde6654edd5 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 17 Nov 2017 09:39:22 +0100 Subject: [PATCH] Do not sanitize uri if this is no needed. Most of the time uri do not contain credentials, so don't run expensive uri cleanup if there is not @ char in uri indicating that this might contain at least a username and possibly also and password. --- src/util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.c b/src/util.c index 8739ad5..4ea3ece 100644 --- a/src/util.c +++ b/src/util.c @@ -743,6 +743,12 @@ char *util_sanitize_uri(const char *uri_str) SoupURI *uri; char *sanitized_uri; + /* Sanitize the uri only in case there is a @ which might be the indicator + * for credentials used in uri. */ + if (!strchr(uri_str, '@')) { + return g_strdup(uri_str); + } + uri = soup_uri_new(uri_str); sanitized_uri = soup_uri_to_string(uri, FALSE); soup_uri_free(uri); -- 2.20.1