From d280d03ac50f2b49f7c08f825dccdebf61b62c57 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 22 Apr 2012 12:28:54 +0200 Subject: * apt-pkg/acquire-worker.cc: - use Dump() to generate the configuration message for sending --- apt-pkg/acquire-worker.cc | 39 +++++++++------------------------------ debian/changelog | 4 +++- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 77e2fc311..8bc043c58 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -467,40 +467,19 @@ bool pkgAcquire::Worker::SendConfiguration() if (OutFd == -1) return false; - - string Message = "601 Configuration\n"; - Message.reserve(2000); - /* Write out all of the configuration directives by walking the + /* Write out all of the configuration directives by walking the configuration tree */ - const Configuration::Item *Top = _config->Tree(0); - for (; Top != 0;) - { - if (Top->Value.empty() == false) - { - string Line = "Config-Item: " + QuoteString(Top->FullTag(),"=\"\n") + "="; - Line += QuoteString(Top->Value,"\n") + '\n'; - Message += Line; - } - - if (Top->Child != 0) - { - Top = Top->Child; - continue; - } - - while (Top != 0 && Top->Next == 0) - Top = Top->Parent; - if (Top != 0) - Top = Top->Next; - } - Message += '\n'; + std::ostringstream Message; + Message << "601 Configuration\n"; + _config->Dump(Message, NULL, "Config-Item: %F=%V\n", false); + Message << '\n'; if (Debug == true) - clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl; - OutQueue += Message; - OutReady = true; - + clog << " -> " << Access << ':' << QuoteString(Message.str(),"\n") << endl; + OutQueue += Message.str(); + OutReady = true; + return true; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index cbbedda0d..79c09b092 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,10 @@ apt (0.9.3) unstable; urgency=low - remove the message size limit from ioprintf and strprintf * apt-pkg/contrib/configuration.cc: - add a more versatile Dump() method + * apt-pkg/acquire-worker.cc: + - use Dump() to generate the configuration message for sending - -- David Kalnischkies Sun, 22 Apr 2012 12:27:47 +0200 + -- David Kalnischkies Sun, 22 Apr 2012 12:28:13 +0200 apt (0.9.2) unstable; urgency=low -- cgit v1.2.3