X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fhttpget.cxx;h=a8e226066a7bbf2f67d6e8496a82ce9f3844c96b;hb=d90647e9babf61a2fb6cef1ef994e360beb876a4;hp=513bb4b22feea91243b7454dccb290d285e1da28;hpb=a2249becba1d574d567791ef8b03ef50b129eb90;p=simgear.git diff --git a/simgear/io/httpget.cxx b/simgear/io/httpget.cxx index 513bb4b2..a8e22606 100644 --- a/simgear/io/httpget.cxx +++ b/simgear/io/httpget.cxx @@ -5,11 +5,14 @@ #include // for STDOUT_FILENO #include #include +#include #include #include #include #include +#include +#include using namespace simgear; using std::cout; @@ -119,9 +122,19 @@ int main(int argc, char* argv[]) } // of arguments iteration if (!proxy.empty()) { - cl.setProxy(proxy, proxyAuth); + int colonPos = proxy.find(':'); + string proxyHost = proxy; + int proxyPort = 8800; + if (colonPos >= 0) { + proxyHost = proxy.substr(0, colonPos); + proxyPort = strutils::to_int(proxy.substr(colonPos + 1)); + } + + cl.setProxy(proxyHost, proxyPort, proxyAuth); } + signal(SIGPIPE, SIG_IGN); + if (!outFile) { outFile = new SGFile(STDOUT_FILENO); } @@ -140,9 +153,10 @@ int main(int argc, char* argv[]) cl.makeRequest(req); while (!req->complete()) { - NetChannel::poll(100); + cl.update(); + sleepForMSec(100); } - + if (req->responseCode() != 200) { cerr << "got response:" << req->responseCode() << endl; cerr << "\treason:" << req->responseReason() << endl;