]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* fixed a problem when it comes to the cache rebuilding
[apt.git] / methods / http.cc
index 365d172db9163486a678baf761247c59c8c4af12..81a64d7a3f1e769ddf58a45cecdf7e51c35873ba 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: http.cc,v 1.58 2004/02/27 00:52:41 mdz Exp $
+// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
 /* ######################################################################
 
    HTTP Aquire Method - This is the HTTP aquire method for APT.
@@ -203,13 +203,17 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
    {      
       if (Buf[I%Size] != '\n')
         continue;
-      for (I++; I < InP && Buf[I%Size] == '\r'; I++);
+      ++I;
+      if (I < InP  && Buf[I%Size] == '\r')
+         ++I;
       
       if (Single == false)
       {
         if (Buf[I%Size] != '\n')
            continue;
-        for (I++; I < InP && Buf[I%Size] == '\r'; I++);
+         ++I;
+         if (I < InP  && Buf[I%Size] == '\r')
+            ++I;
       }
       
       if (I > InP)
@@ -510,14 +514,14 @@ bool ServerState::HeaderLine(string Line)
       {
         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"));
+           return _error->Error(_("The HTTP server sent an invalid reply header"));
       }
       else
       {
         Major = 0;
         Minor = 9;
         if (sscanf(Line.c_str(),"HTTP %u %[^\n]",&Result,Code) != 2)
-           return _error->Error(_("The http server sent an invalid reply header"));
+           return _error->Error(_("The HTTP server sent an invalid reply header"));
       }
 
       /* Check the HTTP response header to get the default persistance
@@ -546,7 +550,7 @@ bool ServerState::HeaderLine(string Line)
         return true;
       
       if (sscanf(Val.c_str(),"%lu",&Size) != 1)
-        return _error->Error(_("The http server sent an invalid Content-Length header"));
+        return _error->Error(_("The HTTP server sent an invalid Content-Length header"));
       return true;
    }
 
@@ -561,9 +565,9 @@ bool ServerState::HeaderLine(string Line)
       HaveContent = true;
       
       if (sscanf(Val.c_str(),"bytes %lu-%*u/%lu",&StartPos,&Size) != 2)
-        return _error->Error(_("The http server sent an invalid Content-Range header"));
+        return _error->Error(_("The HTTP server sent an invalid Content-Range header"));
       if ((unsigned)StartPos > Size)
-        return _error->Error(_("This http server has broken range support"));
+        return _error->Error(_("This HTTP server has broken range support"));
       return true;
    }
    
@@ -825,7 +829,7 @@ bool HttpMethod::ServerDie(ServerState *Srv)
    {
       Srv->Close();
       if (LErrno == 0)
-        return _error->Error(_("Error reading from server Remote end closed connection"));
+        return _error->Error(_("Error reading from server. Remote end closed connection"));
       errno = LErrno;
       return _error->Errno("read",_("Error reading from server"));
    }
@@ -1058,7 +1062,7 @@ int HttpMethod::Loop()
         // The header data is bad
         case 2:
         {
-           _error->Error(_("Bad header Data"));
+           _error->Error(_("Bad header data"));
            Fail(true);
            RotateDNS();
            continue;
@@ -1179,6 +1183,8 @@ int HttpMethod::Loop()
 
 int main()
 {
+   setlocale(LC_ALL, "");
+
    HttpMethod Mth;
    
    return Mth.Loop();