summaryrefslogtreecommitdiff
path: root/src/NetrcAuthResolver.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:12:52 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:20:27 +0900
commitd64089632e82a2548752c7a6baaa68365a795a74 (patch)
tree57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/NetrcAuthResolver.cc
parentc81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff)
parenta7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff)
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/NetrcAuthResolver.cc')
-rw-r--r--src/NetrcAuthResolver.cc40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/NetrcAuthResolver.cc b/src/NetrcAuthResolver.cc
index 593fd81e..e1cc3765 100644
--- a/src/NetrcAuthResolver.cc
+++ b/src/NetrcAuthResolver.cc
@@ -39,16 +39,18 @@
namespace aria2 {
-NetrcAuthResolver::NetrcAuthResolver()
- : netrc_(nullptr), ignoreDefault_(false) {}
+NetrcAuthResolver::NetrcAuthResolver() : netrc_(nullptr), ignoreDefault_(false)
+{
+}
std::unique_ptr<AuthConfig>
NetrcAuthResolver::resolveAuthConfig(const std::string& hostname)
{
auto authConfig = getUserDefinedAuthConfig();
- if(authConfig) {
+ if (authConfig) {
return authConfig;
- } else {
+ }
+ else {
return findNetrcAuthenticator(hostname);
}
}
@@ -56,35 +58,29 @@ NetrcAuthResolver::resolveAuthConfig(const std::string& hostname)
std::unique_ptr<AuthConfig>
NetrcAuthResolver::findNetrcAuthenticator(const std::string& hostname) const
{
- if(!netrc_) {
+ if (!netrc_) {
return getDefaultAuthConfig();
- } else {
+ }
+ else {
auto auth = netrc_->findAuthenticator(hostname);
- if(!auth) {
+ if (!auth) {
return getDefaultAuthConfig();
- } else {
- if(ignoreDefault_ && auth->getMachine().empty()) {
+ }
+ else {
+ if (ignoreDefault_ && auth->getMachine().empty()) {
return getDefaultAuthConfig();
- } else {
+ }
+ else {
return make_unique<AuthConfig>(auth->getLogin(), auth->getPassword());
}
}
}
}
-void NetrcAuthResolver::setNetrc(Netrc* netrc)
-{
- netrc_ = netrc;
-}
+void NetrcAuthResolver::setNetrc(Netrc* netrc) { netrc_ = netrc; }
-void NetrcAuthResolver::ignoreDefault()
-{
- ignoreDefault_ = true;
-}
+void NetrcAuthResolver::ignoreDefault() { ignoreDefault_ = true; }
-void NetrcAuthResolver::useDefault()
-{
- ignoreDefault_ = false;
-}
+void NetrcAuthResolver::useDefault() { ignoreDefault_ = false; }
} // namespace aria2