]> git.saurik.com Git - apt.git/blobdiff - methods/server.cc
add testcase for the autoremove feature
[apt.git] / methods / server.cc
index e12c23c0759b98156c92b2d01b16c11bf150caef..6dd3970a6089fa682bbae8bcd13ae23e74b97333 100644 (file)
@@ -291,11 +291,15 @@ ServerMethod::DealWithHeaders(FetchResult &Res)
       }
       else
       {
-         NextURI = DeQuoteString(Server->Location);
-         URI tmpURI = NextURI;
-         // Do not allow a redirection to switch protocol
-         if (tmpURI.Access == "http")
-            return TRY_AGAIN_OR_REDIRECT;
+        NextURI = DeQuoteString(Server->Location);
+        URI tmpURI = NextURI;
+        URI Uri = Queue->Uri;
+        // same protocol redirects are okay
+        if (tmpURI.Access == Uri.Access)
+           return TRY_AGAIN_OR_REDIRECT;
+        // as well as http to https
+        else if (Uri.Access == "http" && tmpURI.Access == "https")
+           return TRY_AGAIN_OR_REDIRECT;
       }
       /* else pass through for error message */
    }
@@ -369,11 +373,11 @@ void ServerMethod::SigTerm(int)
    if (FailFd == -1)
       _exit(100);
 
-   struct timespec times[2];
+   struct timeval times[2];
    times[0].tv_sec = FailTime;
    times[1].tv_sec = FailTime;
-   times[0].tv_nsec = times[1].tv_nsec = 0;
-   futimens(FailFd, times);
+   times[0].tv_usec = times[1].tv_usec = 0;
+   utimes(FailFile.c_str(), times);
    close(FailFd);
 
    _exit(100);
@@ -539,10 +543,10 @@ int ServerMethod::Loop()
            File = 0;
            
            // Timestamp
-           struct timespec times[2];
+           struct timeval times[2];
            times[0].tv_sec = times[1].tv_sec = Server->Date;
-           times[0].tv_nsec = times[1].tv_nsec = 0;
-           utimensat(AT_FDCWD, Queue->DestFile.c_str(), times, AT_SYMLINK_NOFOLLOW);
+           times[0].tv_usec = times[1].tv_usec = 0;
+           utimes(Queue->DestFile.c_str(), times);
 
            // Send status to APT
            if (Result == true)