]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* apt-pkg/indexcopy.cc:
[apt.git] / methods / http.cc
index 26abc14d97b8c4340ebe3214525334c88ec22728..13f9cbe0613a01d4c102961efc6a15248c6343e8 100644 (file)
@@ -948,9 +948,25 @@ HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
            && Srv->Result != 304    // Not Modified
            && Srv->Result != 306))  // (Not part of HTTP/1.1, reserved)
    {
-      if (!Srv->Location.empty())
+      if (Srv->Location.empty() == true);
+      else if (Srv->Location[0] == '/' && Queue->Uri.empty() == false)
       {
-         NextURI = Srv->Location;
+        URI Uri = Queue->Uri;
+        if (Uri.Host.empty() == false)
+        {
+           if (Uri.Port != 0)
+              strprintf(NextURI, "http://%s:%u", Uri.Host.c_str(), Uri.Port);
+           else
+              NextURI = "http://" + Uri.Host;
+        }
+        else
+           NextURI.clear();
+        NextURI.append(DeQuoteString(Srv->Location));
+        return TRY_AGAIN_OR_REDIRECT;
+      }
+      else
+      {
+         NextURI = DeQuoteString(Srv->Location);
          return TRY_AGAIN_OR_REDIRECT;
       }
       /* else pass through for error message */