summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorEugene V. Lyubimkin <jackyf@1501-debian>2008-10-26 13:39:10 +0200
committerEugene V. Lyubimkin <jackyf@1501-debian>2008-10-26 13:39:10 +0200
commitc94e518c5ee831c21063ce38e6446113db087456 (patch)
treea2ac1e38e7441e3223cdab3cfabb71859450274a /apt-pkg
parent2d6f9accbcf38923911854a918d971c0905b262c (diff)
Switched from regexp to using existing URI class to strip user/password.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 6f30a52da..70212e5c9 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1343,21 +1343,10 @@ bool ListUpdate(pkgAcquireStatus &Stat,
(*I)->Finished();
- // stripping username/password from URI if present
- string descUri = (*I)->DescURI();
- regex_t userPassRegex;
- regcomp(&userPassRegex, "\\://(\\w+)\\:(\\w+)@", REG_EXTENDED);
- regmatch_t userPassMatch;
- int regMatchResult = regexec(&userPassRegex, descUri.c_str(), 1, &userPassMatch, 0);
- if (regMatchResult == 0 && userPassMatch.rm_so != -1) // regexp matched
- {
- // really stripping
- size_t stripStart = userPassMatch.rm_so + 3;
- size_t stripEnd = userPassMatch.rm_eo;
- descUri = descUri.substr(0, stripStart) +
- descUri.substr(stripEnd, string::npos);
- }
- regfree(&userPassRegex);
+ ::URI uri((*I)->DescURI());
+ uri.User.clear();
+ uri.Password.clear();
+ string descUri = string(uri);
_error->Warning(_("Failed to fetch %s %s\n"), descUri.c_str(),
(*I)->ErrorText.c_str());