Do not sanitize uri if this is no needed.
authorDaniel Carl <danielcarl@gmx.de>
Fri, 17 Nov 2017 08:39:22 +0000 (09:39 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 17 Nov 2017 08:39:22 +0000 (09:39 +0100)
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

index 8739ad5..4ea3ece 100644 (file)
@@ -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);