Skip to content

Commit

Permalink
Do not sanitize uri if this is no needed.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fanglingsu committed Nov 17, 2017
1 parent 19cae91 commit 43f7338
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 43f7338

Please sign in to comment.