#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/hashes.h>
void pkgAcqMethod::Fail(string Err,bool Transient)
{
// Strip out junk from the error messages
void pkgAcqMethod::Fail(string Err,bool Transient)
{
// Strip out junk from the error messages
{
std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n"
<< "Message: " << Err << " " << IP << "\n";
{
std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n"
<< "Message: " << Err << " " << IP << "\n";
- const char *Equals = I;
- for (; Equals < MsgEnd && *Equals != '='; Equals++);
- const char *End = Equals;
- for (; End < MsgEnd && *End != '\n'; End++);
- if (End == Equals)
+ const char *Equals = (const char*) memchr(I, '=', MsgEnd - I);
+ if (Equals == NULL)
Cnf.Set(DeQuoteString(string(I,Equals-I)),
DeQuoteString(string(Equals+1,End-Equals-1)));
Cnf.Set(DeQuoteString(string(I,Equals-I)),
DeQuoteString(string(Equals+1,End-Equals-1)));
/*}}}*/
// AcqMethod::Redirect - Send a redirect message /*{{{*/
// ---------------------------------------------------------------------
/*}}}*/
// AcqMethod::Redirect - Send a redirect message /*{{{*/
// ---------------------------------------------------------------------
-/* This method sends the redirect message and also manipulates the queue
- to keep the pipeline synchronized. */
+/* This method sends the redirect message and dequeues the item as
+ * the worker will enqueue again later on to the right queue */
- std::cout << "103 Redirect\nURI: ";
- if (Queue != 0)
- std::cout << Queue->Uri << "\n";
- else
- std::cout << "<UNKNOWN>\n";
- std::cout << "New-URI: " << NewURI << "\n"
+ std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n"
+ << "New-URI: " << NewURI << "\n"
-
- // Change the URI for the request.
- Queue->Uri = NewURI;
-
- /* To keep the pipeline synchronized, move the current request to
- the end of the queue, past the end of the current pipeline. */
- FetchItem *I;
- for (I = Queue; I->Next != 0; I = I->Next) ;
- I->Next = Queue;
- Queue = Queue->Next;
- I->Next->Next = 0;
- if (QueueBack == 0)
- QueueBack = I->Next;