7 #include <boost/foreach.hpp>
10 #include <simgear/io/sg_file.hxx>
11 #include <simgear/io/HTTPClient.hxx>
12 #include <simgear/io/HTTPRepository.hxx>
13 #include <simgear/misc/strutils.hxx>
14 #include <simgear/timing/timestamp.hxx>
15 #include <simgear/misc/sg_dir.hxx>
16 #include <simgear/debug/logstream.hxx>
18 using namespace simgear;
24 int main(int argc, char* argv[])
27 string proxy, proxyAuth;
31 sglog().setLogLevels( SG_ALL, SG_INFO );
33 for (int a=0; a<argc;++a) {
34 if (argv[a][0] == '-') {
35 if (!strcmp(argv[a], "--proxy")) {
37 } else if (!strcmp(argv[a], "--auth")) {
38 proxyAuth = argv[++a];
40 } else { // of argument starts with a hyphen
43 } // of arguments iteration
46 int colonPos = proxy.find(':');
47 string proxyHost = proxy;
50 proxyHost = proxy.substr(0, colonPos);
51 proxyPort = strutils::to_int(proxy.substr(colonPos + 1));
54 cl.setProxy(proxyHost, proxyPort, proxyAuth);
58 signal(SIGPIPE, SIG_IGN);
62 cerr << "no URL argument specificed" << endl;
66 SGPath rootPath = simgear::Dir::current().path();
67 HTTPRepository* repo = new HTTPRepository(rootPath, &cl);
68 repo->setBaseUrl(url);
71 while (repo->isDoingSync()) {
73 SGTimeStamp::sleepForMSec(100);
76 if (repo->failure() != AbstractRepository::REPO_NO_ERROR) {
77 cerr << "got response:" << repo->failure() << endl;