#include <stdio.h>
#include <errno.h>
#include <string.h>
-#include <iostream>
#include <apti18n.h>
// Internet stuff
unsigned long PipelineDepth = 10;
unsigned long TimeOut = 120;
bool Debug = false;
-
+URI Proxy;
unsigned long CircleBuf::BwReadLimit=0;
unsigned long CircleBuf::BwTickReadData=0;
depth. */
bool HttpMethod::Fetch(FetchItem *)
{
- if (Server == 0)
+ if (Server == 0)
return true;
// Queue the requests
}
/*}}}*/
-int main()
-{
- setlocale(LC_ALL, "");
-
- HttpMethod Mth;
-
- return Mth.Loop();
-}
#define MAXLEN 360
-#include <iostream>
+
using std::cout;
using std::endl;
bool ServerDie(ServerState *Srv);
int DealWithHeaders(FetchResult &Res,ServerState *Srv);
- virtual bool Fetch(FetchItem *);
virtual bool Configuration(string Message);
// In the event of a fatal signal this file will be closed and timestamped.
static int FailFd;
static time_t FailTime;
static void SigTerm(int);
+
+ protected:
+ virtual bool Fetch(FetchItem *);
public:
friend class ServerState;
};
};
-URI Proxy;
#endif
--- /dev/null
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/acquire-method.h>
+
+#include "connect.h"
+#include "rfc2553emu.h"
+#include "http.h"
+
+
+int main()
+{
+ setlocale(LC_ALL, "");
+
+ HttpMethod Mth;
+ return Mth.Loop();
+}
PROGRAM=http
SLIBS = -lapt-pkg $(SOCKETLIBS)
LIB_MAKES = apt-pkg/makefile
-SOURCE = http.cc rfc2553emu.cc connect.cc
+SOURCE = http.cc http_main.cc rfc2553emu.cc connect.cc
include $(PROGRAM_H)
# The ftp method
SOURCE = rsh.cc
include $(PROGRAM_H)
+# The mirror method
+PROGRAM=mirror
+SLIBS = -lapt-pkg $(SOCKETLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = mirror.cc http.cc rfc2553emu.cc connect.cc
+include $(PROGRAM_H)
+
# SSH and vzip2 method symlink
binary: $(BIN)/ssh $(BIN)/bzip2
veryclean: clean-$(BIN)/ssh clean-$(BIN)/bzip2
--- /dev/null
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: mirror.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
+/* ######################################################################
+
+ Mirror Aquire Method - This is the Mirror aquire method for APT.
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/acquire-method.h>
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
+
+#include <fstream>
+#include <iostream>
+using namespace std;
+
+#include "mirror.h"
+#include "http.h"
+
+ /*}}}*/
+
+MirrorMethod::MirrorMethod()
+ : pkgAcqMethod("1.2",Pipeline | SendConfig), HasMirrorFile(false)
+{
+#if 0
+ HasMirrorFile=true;
+ BaseUri="http://people.ubuntu.com/~mvo/mirror/mirrors///";
+ Mirror="http://de.archive.ubuntu.com/ubuntu/";
+#endif
+};
+
+bool MirrorMethod::GetMirrorFile(string uri)
+{
+ string Marker = _config->Find("Acquire::Mirror::MagicMarker","///");
+ BaseUri = uri.substr(0,uri.find(Marker));
+ BaseUri.replace(0,strlen("mirror://"),"http://");
+
+ MirrorFile = _config->FindDir("Dir::State::lists") + URItoFileName(BaseUri);
+
+ cerr << "base-uri: " << BaseUri << endl;
+ cerr << "mirror-file: " << MirrorFile << endl;
+
+ // FIXME: fetch it with curl
+ pkgAcquire Fetcher;
+ new pkgAcqFile(&Fetcher, BaseUri, "", 0, "", "", "", MirrorFile);
+ bool res = (Fetcher.Run() == pkgAcquire::Continue);
+ cerr << "fetch-result: " << res << endl;
+
+ if(res)
+ HasMirrorFile = true;
+ Fetcher.Shutdown();
+ return true;
+}
+
+bool MirrorMethod::SelectMirror()
+{
+ ifstream in(MirrorFile.c_str());
+ getline(in, Mirror);
+ cerr << "Mirror: " << Mirror << endl;
+}
+
+// MirrorMethod::Fetch - Fetch an item /*{{{*/
+// ---------------------------------------------------------------------
+/* This adds an item to the pipeline. We keep the pipeline at a fixed
+ depth. */
+bool MirrorMethod::Fetch(FetchItem *Itm)
+{
+ // get mirror information
+ if(!HasMirrorFile)
+ {
+ GetMirrorFile(Itm->Uri);
+ SelectMirror();
+ }
+
+ // change the items in the queue
+ Itm->Uri.replace(0,BaseUri.size()+_config->Find("Acquire::Mirror::MagicMarker","///").size()+2/*len("mirror")-len("http")*/,Mirror);
+ cerr << "new Fetch-uri: " << Itm->Uri << endl;
+
+ // FIXME: fetch it with!
+
+};
+
+int main()
+{
+ setlocale(LC_ALL, "");
+
+ MirrorMethod Mth;
+
+ return Mth.Run();
+}
+
+
--- /dev/null
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
+// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
+/* ######################################################################
+
+ MIRROR Aquire Method - This is the MIRROR aquire method for APT.
+
+ ##################################################################### */
+ /*}}}*/
+
+#ifndef APT_MIRROR_H
+#define APT_MIRROR_H
+
+
+#include <iostream>
+
+using std::cout;
+using std::cerr;
+using std::endl;
+
+#include "http.h"
+
+class MirrorMethod : public pkgAcqMethod
+{
+ FetchResult Res;
+ string Mirror;
+ string BaseUri;
+ string MirrorFile;
+ bool HasMirrorFile;
+
+ protected:
+ bool GetMirrorFile(string uri);
+ bool SelectMirror();
+ public:
+ MirrorMethod();
+ virtual bool Fetch(FetchItem *Itm);
+};
+
+
+#endif
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-11 20:34+0200\n"
+"POT-Creation-Date: 2006-11-24 16:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Unable to accept connection"
msgstr ""
-#: methods/ftp.cc:864 methods/http.cc:958 methods/rsh.cc:303
+#: methods/ftp.cc:864 methods/http.cc:957 methods/rsh.cc:303
msgid "Problem hashing file"
msgstr ""
msgid "Read error from %s process"
msgstr ""
-#: methods/http.cc:376
+#: methods/http.cc:375
msgid "Waiting for headers"
msgstr ""
-#: methods/http.cc:522
+#: methods/http.cc:521
#, c-format
msgid "Got a single header line over %u chars"
msgstr ""
-#: methods/http.cc:530
+#: methods/http.cc:529
msgid "Bad header line"
msgstr ""
-#: methods/http.cc:549 methods/http.cc:556
+#: methods/http.cc:548 methods/http.cc:555
msgid "The HTTP server sent an invalid reply header"
msgstr ""
-#: methods/http.cc:585
+#: methods/http.cc:584
msgid "The HTTP server sent an invalid Content-Length header"
msgstr ""
-#: methods/http.cc:600
+#: methods/http.cc:599
msgid "The HTTP server sent an invalid Content-Range header"
msgstr ""
-#: methods/http.cc:602
+#: methods/http.cc:601
msgid "This HTTP server has broken range support"
msgstr ""
-#: methods/http.cc:626
+#: methods/http.cc:625
msgid "Unknown date format"
msgstr ""
-#: methods/http.cc:773
+#: methods/http.cc:772
msgid "Select failed"
msgstr ""
-#: methods/http.cc:778
+#: methods/http.cc:777
msgid "Connection timed out"
msgstr ""
-#: methods/http.cc:801
+#: methods/http.cc:800
msgid "Error writing to output file"
msgstr ""
-#: methods/http.cc:832
+#: methods/http.cc:831
msgid "Error writing to file"
msgstr ""
-#: methods/http.cc:860
+#: methods/http.cc:859
msgid "Error writing to the file"
msgstr ""
-#: methods/http.cc:874
+#: methods/http.cc:873
msgid "Error reading from server. Remote end closed connection"
msgstr ""
-#: methods/http.cc:876
+#: methods/http.cc:875
msgid "Error reading from server"
msgstr ""
-#: methods/http.cc:1107
+#: methods/http.cc:1106
msgid "Bad header data"
msgstr ""
-#: methods/http.cc:1124
+#: methods/http.cc:1123
msgid "Connection failed"
msgstr ""
-#: methods/http.cc:1215
+#: methods/http.cc:1214
msgid "Internal error"
msgstr ""
msgstr ""
#: apt-pkg/acquire-item.cc:640
-msgid "There are no public key available for the following key IDs:\n"
+msgid "There is no public key available for the following key IDs:\n"
msgstr ""
#: apt-pkg/acquire-item.cc:753