summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-12-10 16:07:43 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-12-10 16:07:43 +0100
commit9307ef07498d37c0b5e05b036195abaf7ad0105c (patch)
treecf85e1f46b31161dc4c601fa79fc76a85154d696 /methods/http.cc
parent1eb5622017241e874016b759625b2b706ed9a74c (diff)
parente4b16ac68196eab5e58abf715459fe70c199cff3 (diff)
* merge lp:~mvo/apt/netrc branch, this adds support for a
/etc/apt/auth.conf that can be used to store username/passwords in a "netrc" style file (with the extension that it supports "/" in a machine definition). Based on the maemo git branch. * apt-pkg/deb/dpkgpm.cc: - add "purge" to list of known actions
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/methods/http.cc b/methods/http.cc
index 461a98406..3b210f6b6 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -29,6 +29,7 @@
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
+#include <apt-pkg/netrc.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -42,6 +43,7 @@
#include <map>
#include <apti18n.h>
+
// Internet stuff
#include <netdb.h>
@@ -49,7 +51,6 @@
#include "connect.h"
#include "rfc2553emu.h"
#include "http.h"
-
/*}}}*/
using namespace std;
@@ -724,10 +725,12 @@ 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)
+ {
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)