summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire.cc2
-rw-r--r--apt-pkg/contrib/progress.cc2
-rw-r--r--apt-pkg/deb/debmetaindex.cc3
-rw-r--r--apt-pkg/init.cc2
-rw-r--r--apt-pkg/tagfile.cc2
-rw-r--r--ftparchive/apt-ftparchive.cc2
-rw-r--r--methods/connect.cc4
-rw-r--r--methods/http.cc32
-rw-r--r--methods/http.h1
-rw-r--r--test/CMakeLists.txt1
10 files changed, 17 insertions, 34 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 086cb378c..6a6167f3b 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -1279,7 +1279,7 @@ static struct timeval GetTimevalFromSteadyClock()
auto const Time = std::chrono::steady_clock::now().time_since_epoch();
auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
- return { Time_sec.count(), Time_usec.count() };
+ return { static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count()) };
}
bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
{
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 806bd47f8..bd604c5b0 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -119,7 +119,7 @@ bool OpProgress::CheckChange(float Interval)
auto const Now = std::chrono::steady_clock::now().time_since_epoch();
auto const Now_sec = std::chrono::duration_cast<std::chrono::seconds>(Now);
auto const Now_usec = std::chrono::duration_cast<std::chrono::microseconds>(Now - Now_sec);
- struct timeval NowTime = { Now_sec.count(), Now_usec.count() };
+ struct timeval NowTime = { static_cast<time_t>(Now_sec.count()), static_cast<suseconds_t>(Now_usec.count()) };
std::chrono::duration<decltype(Interval)> Delta =
std::chrono::seconds(NowTime.tv_sec - LastTime.tv_sec) +
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 774560041..0290f3df9 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -562,9 +562,6 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro
if (CheckValidUntil == true)
{
- if (Date == 0)
- _error->Warning( _("Invalid '%s' entry in Release file %s"), "Date", Filename.c_str());
-
std::string const StrValidUntil = Section.FindS("Valid-Until");
// if we have a Valid-Until header in the Release file, use it as default
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index a619368ec..d69d7da32 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -177,7 +177,7 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.distUpgrade$");
// Repository security
- Cnf.CndSet("Acquire::AllowInsecureRepositories", false);
+ Cnf.CndSet("Acquire::AllowInsecureRepositories", true);
Cnf.CndSet("Acquire::AllowWeakRepositories", false);
Cnf.CndSet("Acquire::AllowDowngradeToInsecureRepositories", false);
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 1c747fddc..5f39e5757 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -13,8 +13,6 @@
#include <config.h>
#include <apt-pkg/mmap.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/tagfile-keys.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/string_view.h>
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 077701cc0..018df3d8c 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -53,7 +53,7 @@ static struct timeval GetTimevalFromSteadyClock() /*{{{*/
auto const Time = std::chrono::steady_clock::now().time_since_epoch();
auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time);
auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec);
- return { Time_sec.count(), Time_usec.count() };
+ return { static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count()) };
}
/*}}}*/
diff --git a/methods/connect.cc b/methods/connect.cc
index 1d6f8919d..0e01e5ca4 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -273,8 +273,8 @@ static ResultState WaitAndCheckErrors(std::list<Connection> &Conns, std::unique_
struct timeval tv = {
// Split our millisecond timeout into seconds and microseconds
- .tv_sec = TimeoutMsec / 1000,
- .tv_usec = (TimeoutMsec % 1000) * 1000,
+ .tv_sec = static_cast<time_t>(TimeoutMsec / 1000),
+ .tv_usec = static_cast<suseconds_t>((TimeoutMsec % 1000) * 1000),
};
// We will return once we have no more connections, a time out, or
diff --git a/methods/http.cc b/methods/http.cc
index 647b35c6b..16c0de611 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -164,32 +164,28 @@ void HttpMethod::RotateDNS() /*{{{*/
{
}
/*}}}*/
-BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res)/*{{{*/
+BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)/*{{{*/
{
- auto ret = BaseHttpMethod::DealWithHeaders(Res);
+ auto ret = BaseHttpMethod::DealWithHeaders(Res, Req);
if (ret != BaseHttpMethod::FILE_IS_OPEN)
return ret;
-
- // Open the file
- delete File;
- File = new FileFd(Queue->DestFile,FileFd::WriteAny);
- if (_error->PendingError() == true)
+ if (Req.File.Open(Queue->DestFile, FileFd::WriteAny) == false)
return ERROR_NOT_FROM_SERVER;
FailFile = Queue->DestFile;
FailFile.c_str(); // Make sure we don't do a malloc in the signal handler
- FailFd = File->Fd();
- FailTime = Server->Date;
+ FailFd = Req.File.Fd();
+ FailTime = Req.Date;
- if (Server->InitHashes(Queue->ExpectedHashes) == false || Server->AddPartialFileToHashes(*File) == false)
+ if (Server->InitHashes(Queue->ExpectedHashes) == false || Req.AddPartialFileToHashes(Req.File) == false)
{
_error->Errno("read",_("Problem hashing file"));
return ERROR_NOT_FROM_SERVER;
}
- if (Server->StartPos > 0)
- Res.ResumePoint = Server->StartPos;
+ if (Req.StartPos > 0)
+ Res.ResumePoint = Req.StartPos;
- SetNonBlock(File->Fd(),true);
+ SetNonBlock(Req.File.Fd(),true);
return FILE_IS_OPEN;
}
@@ -544,22 +540,14 @@ int HttpMethod::Loop()
return 0;
}
- /*}}}*/
HttpMethod::HttpMethod(std::string &&pProg) : BaseHttpMethod(pProg.c_str(), "1.2", Pipeline | SendConfig)/*{{{*/
{
- SeccompFlags = aptMethod::BASE | aptMethod::NETWORK;
-
auto addName = std::inserter(methodNames, methodNames.begin());
- if (Binary != "http")
+ if (Binary != "http" && Binary != "https")
addName = "http";
auto const plus = Binary.find('+');
if (plus != std::string::npos)
- {
- auto name2 = Binary.substr(plus + 1);
- if (std::find(methodNames.begin(), methodNames.end(), name2) == methodNames.end())
- addName = std::move(name2);
addName = Binary.substr(0, plus);
- }
File = 0;
Server = 0;
}
diff --git a/methods/http.h b/methods/http.h
index f52aa8a1f..15691379d 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -38,6 +38,7 @@ class HttpMethod : public BaseHttpMethod
virtual DealWithHeadersResult DealWithHeaders(FetchResult &Res, RequestState &Req) APT_OVERRIDE;
protected:
+ FileFd *File;
std::string AutoDetectProxyCmd;
public:
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2f47b5c32..d7a0a0dbf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,2 +1 @@
add_subdirectory(libapt)
-add_subdirectory(interactive-helper)