]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* merged with apt--mvo
[apt.git] / methods / http.cc
index dc3f0b7639f7d5f34530b65a1adea7bb5b0eddcc..1833f41efdbaf692213e9a926719ab20d1f43832 100644 (file)
@@ -241,28 +241,23 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
       if (Buf[I%Size] != '\n')
         continue;
       ++I;
-      if (I < InP  && Buf[I%Size] == '\r')
-         ++I;
       
       if (Single == false)
       {
-        if (Buf[I%Size] != '\n')
-           continue;
-         ++I;
          if (I < InP  && Buf[I%Size] == '\r')
             ++I;
+         if (I >= InP || Buf[I%Size] != '\n')
+            continue;
+         ++I;
       }
       
-      if (I > InP)
-        I = InP;
-      
       Data = "";
       while (OutP < I)
       {
         unsigned long Sz = LeftWrite();
         if (Sz == 0)
            return false;
-        if (I - OutP < LeftWrite())
+        if (I - OutP < Sz)
            Sz = I - OutP;
         Data += string((char *)(Buf + (OutP%Size)),Sz);
         OutP += Sz;
@@ -662,7 +657,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
       will glitch HTTP/1.0 proxies because they do not filter it out and 
       pass it on, HTTP/1.1 says the connection should default to keep alive
       and we expect the proxy to do this */
-   if (Proxy.empty() == true)
+   if (Proxy.empty() == true || Proxy.Host.empty())
       sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n",
              QuoteString(Uri.Path,"~").c_str(),ProperHost.c_str());
    else
@@ -719,7 +714,7 @@ 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\r\n\r\n";
+   Req += "User-Agent: Ubuntu APT-HTTP/1.3\r\n\r\n";
    
    if (Debug == true)
       cerr << Req << endl;