diff options
Diffstat (limited to 'src/NetrcAuthResolver.cc')
| -rw-r--r-- | src/NetrcAuthResolver.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/NetrcAuthResolver.cc b/src/NetrcAuthResolver.cc index 647af81a..6a77d16d 100644 --- a/src/NetrcAuthResolver.cc +++ b/src/NetrcAuthResolver.cc @@ -38,6 +38,8 @@ namespace aria2 { +NetrcAuthResolver::NetrcAuthResolver():_ignoreDefault(false) {} + AuthConfigHandle NetrcAuthResolver::resolveAuthConfig(const std::string& hostname) { if(_userDefinedAuthConfig.isNull()) { @@ -56,7 +58,12 @@ AuthConfigHandle NetrcAuthResolver::findNetrcAuthenticator(const std::string& ho if(auth.isNull()) { return _defaultAuthConfig; } else { - return SharedHandle<AuthConfig>(new AuthConfig(auth->getLogin(), auth->getPassword())); + if(_ignoreDefault && auth->getMachine() == "") { + return _defaultAuthConfig; + } else { + return SharedHandle<AuthConfig> + (new AuthConfig(auth->getLogin(), auth->getPassword())); + } } } } @@ -71,4 +78,14 @@ NetrcHandle NetrcAuthResolver::getNetrc() const return _netrc; } +void NetrcAuthResolver::ignoreDefault() +{ + _ignoreDefault = true; +} + +void NetrcAuthResolver::useDefault() +{ + _ignoreDefault = false; +} + } // namespace aria2 |
