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.
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);