summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/methods/http.cc b/methods/http.cc
index d3a5d718f..5f5cd2631 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -758,7 +758,25 @@ void HttpMethod::SendReq(FetchItem *Itm)
Req += string("Proxy-Authorization: Basic ") +
Base64Encode(Server->Proxy.User + ":" + Server->Proxy.Password) + "\r\n";
+
maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
+ if(Uri.User.empty() || Uri.Password.empty())
+ {
+ std::string const netrcparts = _config->FindDir("Dir::Etc::netrcparts");
+ if (not netrcparts.empty())
+ {
+ _error->PushToStack();
+ std::vector<std::string> files = GetListOfFilesInDir(netrcparts, "conf", true, true);
+ for (std::vector<std::string>::const_iterator netrc = files.begin(); netrc != files.end(); netrc++)
+ {
+ maybe_add_auth (Uri, *netrc);
+ if (Uri.User.empty() == false || Uri.Password.empty() == false)
+ break;
+ }
+ _error->RevertToStack();
+ }
+ }
+
if (Uri.User.empty() == false || Uri.Password.empty() == false)
{
Req += string("Authorization: Basic ") +