]> git.saurik.com Git - apt.git/commitdiff
add config setting for User-Agent in http and https to the Acquire group,
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 25 Nov 2009 22:20:12 +0000 (23:20 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 25 Nov 2009 22:20:12 +0000 (23:20 +0100)
thanks Timothy J. Miller! (Closes: #355782)

debian/changelog
doc/apt.conf.5.xml
doc/examples/configure-index
methods/http.cc
methods/https.cc

index 51f6cdfa1beababf4aa801772b6c2badabaa6672..ed67aaac29819373c9be11adb659384d5cba2971 100644 (file)
@@ -63,6 +63,9 @@ apt (0.7.25) UNRELEASED; urgency=low
   * cmdline/apt-mark:
     - print an error if a new state file can't be created,
       thanks Carl Chenet! (Closes: #521289)
+  * methods/http{,s}.cc
+    - add config setting for User-Agent to the Acquire group,
+      thanks Timothy J. Miller! (Closes: #355782)
 
   [ Chris Leick ]
   * doc/ various manpages:
index e2db9defbd6424bc2c1f4a6705f1fe8ced509023..726bca2cc0f75ff16f148a82f70fcce9946d4e0e 100644 (file)
@@ -275,7 +275,12 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
      <para>The used bandwidth can be limited with <literal>Acquire::http::Dl-Limit</literal>
      which accepts integer values in kilobyte. The default value is 0 which deactivates
      the limit and tries uses as much as possible of the bandwidth (Note that this option implicit
-     deactivates the download from multiple servers at the same time.)</para></listitem>
+     deactivates the download from multiple servers at the same time.)</para>
+
+     <para><literal>Acquire::http::User-Agent</literal> can be used to set a different
+     User-Agent for the http download method as some proxies allow access for clients
+     only if the client uses a known identifier.</para>
+     </listitem>
      </varlistentry>
 
      <varlistentry><term>https</term>
index 27118fb7e85f8e7c34534b7c4a75a57d51072a08..16e864d89ae6346580cd33df5d875e2ff9b7fef7 100644 (file)
@@ -191,6 +191,7 @@ Acquire
     Max-Age "86400";     // 1 Day age on index files
     No-Store "false";    // Prevent the cache from storing archives    
     Dl-Limit "7";        // 7Kb/sec maximum download rate
+    User-Agent "Debian APT-HTTP/1.3";
   };
 
   // HTTPS method configuration:
@@ -204,6 +205,8 @@ Acquire
         CaPath  "/etc/ssl/certs";
         Verify-Host" "true";
         AllowRedirect  "true";
+
+        User-Agent "Debian APT-CURL/1.0";
   };
 
   ftp
index 461a984067079f6c3f4ed261180d64a3203d3701..8fcff0b5d77e44d1d898a7839db0d4adddd60672 100644 (file)
@@ -728,7 +728,8 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
       Req += string("Authorization: Basic ") + 
           Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
    
-   Req += "User-Agent: Debian APT-HTTP/1.3 ("VERSION")\r\n\r\n";
+   Req += "User-Agent: " + _config->Find("Acquire::http::User-Agent",
+               "Debian APT-HTTP/1.3 ("VERSION")") + "\r\n\r\n";
    
    if (Debug == true)
       cerr << Req << endl;
index 79e6fea3f42d6c1b173993a6092ba5d1a71329da..e8d7bb5c6753fc3070753f0394e15fe0b5784c33 100644 (file)
@@ -209,7 +209,10 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
       curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, dlLimit);
 
    // set header
-   curl_easy_setopt(curl, CURLOPT_USERAGENT,"Debian APT-CURL/1.0 ("VERSION")");
+   curl_easy_setopt(curl, CURLOPT_USERAGENT,
+       _config->Find("Acquire::https::User-Agent",
+               _config->Find("Acquire::http::User-Agent",
+                       "Debian APT-CURL/1.0 ("VERSION")")));
 
    // set timeout
    int timeout = _config->FindI("Acquire::http::Timeout",120);