]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/strutl.cc
delete Memb on read-error in arfile
[apt.git] / apt-pkg / contrib / strutl.cc
index 03b98e93ec4265ec6eb890483f4d065f8660693c..d0e74d8c59cd0590c5d16f2b9252474c45b106e6 100644 (file)
@@ -758,7 +758,8 @@ bool ReadMessages(int Fd, vector<string> &List)
       // Look for the end of the message
       for (char *I = Buffer; I + 1 < End; I++)
       {
-        if (I[0] != '\n' || I[1] != '\n')
+        if (I[1] != '\n' ||
+              (I[0] != '\n' && strncmp(I, "\r\n\r\n", 4) != 0))
            continue;
         
         // Pull the message out
@@ -766,7 +767,7 @@ bool ReadMessages(int Fd, vector<string> &List)
         PartialMessage += Message;
 
         // Fix up the buffer
-        for (; I < End && *I == '\n'; I++);
+        for (; I < End && (*I == '\n' || *I == '\r'); ++I);
         End -= I-Buffer;        
         memmove(Buffer,I,End-Buffer);
         I = Buffer;
@@ -1483,9 +1484,12 @@ URI::operator string()
           
       if (User.empty() == false)
       {
-        Res +=  User;
+        // FIXME: Technically userinfo is permitted even less
+        // characters than these, but this is not conveniently
+        // expressed with a blacklist.
+        Res += QuoteString(User, ":/?#[]@");
         if (Password.empty() == false)
-           Res += ":" + Password;
+           Res += ":" + QuoteString(Password, ":/?#[]@");
         Res += "@";
       }
       
@@ -1524,7 +1528,6 @@ string URI::SiteOnly(const string &URI)
    U.User.clear();
    U.Password.clear();
    U.Path.clear();
-   U.Port = 0;
    return U;
 }
                                                                        /*}}}*/
@@ -1536,7 +1539,6 @@ string URI::NoUserPassword(const string &URI)
    ::URI U(URI);
    U.User.clear();
    U.Password.clear();
-   U.Port = 0;
    return U;
 }
                                                                        /*}}}*/