]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
add config setting for User-Agent in http and https to the Acquire group,
[apt.git] / methods / http.cc
index 50478b44c846e8ffa6a16a8baff5180d84ffea10..2dae87a02be878cb3da87c0c18336a8633b2c743 100644 (file)
@@ -553,7 +553,7 @@ bool ServerState::HeaderLine(string Line)
       // Evil servers return no version
       if (Line[4] == '/')
       {
-        if (sscanf(Line.c_str(),"HTTP/%u.%u %u %[^\n]",&Major,&Minor,
+        if (sscanf(Line.c_str(),"HTTP/%u.%u %u%[^\n]",&Major,&Minor,
                    &Result,Code) != 4)
            return _error->Error(_("The HTTP server sent an invalid reply header"));
       }
@@ -561,7 +561,7 @@ bool ServerState::HeaderLine(string Line)
       {
         Major = 0;
         Minor = 9;
-        if (sscanf(Line.c_str(),"HTTP %u %[^\n]",&Result,Code) != 2)
+        if (sscanf(Line.c_str(),"HTTP %u%[^\n]",&Result,Code) != 2)
            return _error->Error(_("The HTTP server sent an invalid reply header"));
       }
 
@@ -731,7 +731,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;