From 592b78001c381f9cca6f20d8d1d47696bb98c0d1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 16 Oct 2009 15:36:28 +0200 Subject: port netrc support from maemon --- methods/http.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'methods/http.cc') diff --git a/methods/http.cc b/methods/http.cc index 1eba0f279..6bfe80baf 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include + // Internet stuff #include @@ -49,7 +51,6 @@ #include "connect.h" #include "rfc2553emu.h" #include "http.h" - /*}}}*/ using namespace std; @@ -725,9 +726,11 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out) Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n"; if (Uri.User.empty() == false || Uri.Password.empty() == false) + { + maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc")); Req += string("Authorization: Basic ") + Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n"; - + } Req += "User-Agent: Debian APT-HTTP/1.3 ("VERSION")\r\n\r\n"; if (Debug == true) -- cgit v1.2.3 From 1de1f70383ea2d44147ccaceff280fd70faf4c81 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 16 Oct 2009 15:42:05 +0200 Subject: add maybe_add_auth for ftp as well --- methods/http.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'methods/http.cc') diff --git a/methods/http.cc b/methods/http.cc index 6bfe80baf..50478b44c 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -725,9 +725,9 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out) Req += string("Proxy-Authorization: Basic ") + Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n"; + maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc")); if (Uri.User.empty() == false || Uri.Password.empty() == false) { - maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc")); Req += string("Authorization: Basic ") + Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n"; } -- cgit v1.2.3