// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: http.cc,v 1.46 2000/05/28 04:33:59 jgg Exp $
+// $Id: http.cc,v 1.47 2001/02/20 07:03:18 jgg Exp $
/* ######################################################################
HTTP Aquire Method - This is the HTTP aquire method for APT.
else
Proxy = getenv("http_proxy");
- // Parse no_proxy, a , seperated list of hosts
+ // Parse no_proxy, a , separated list of hosts
if (getenv("no_proxy") != 0)
{
const char *Start = getenv("no_proxy");
I = J;
}
+ // 100 Continue is a Nop...
+ if (Result == 100)
+ continue;
+
// Tidy up the connection persistance state.
if (Encoding == Closes && HaveContent == true)
Persistent = false;
else
Persistent = true;
}
-
+
return true;
}
Req += string("Proxy-Authorization: Basic ") +
Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n";
+ if (Uri.User.empty() == false || Uri.Password.empty() == false)
+ Req += string("Authorization: Basic ") +
+ Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
+
Req += "User-Agent: Debian APT-HTTP/1.2\r\n\r\n";
if (Debug == true)
{
_error->Error("Bad header Data");
Fail(true);
+ RotateDNS();
continue;
}
FailCounter = 0;
}
+ RotateDNS();
continue;
}
};
// Run the data
bool Result = Server->RunData();
+ /* If the server is sending back sizeless responses then fill in
+ the size now */
+ if (Res.Size == 0)
+ Res.Size = File->Size();
+
// Close the file, destroy the FD object and timestamp it
FailFd = -1;
delete File;
// Send status to APT
if (Result == true)
{
- Res.MD5Sum = Server->In.MD5->Result();
+ Res.MD5Sum = Server->In.MD5->Result();
URIDone(Res);
}
else
case 5:
{
Fail();
+ RotateDNS();
Server->Close();
break;
}