X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fhttpget.cxx;h=e10a29b41659dd3fc992b77358296ca5d40ce65b;hb=09b0dd2b2d7d934c1d4059cb2cbd3b4fcbb7872f;hp=c52117a9df0e3932ae6e3a06035f0e31f4df8548;hpb=115531e944f51c3295f69f3ed361bf421515cc58;p=simgear.git diff --git a/simgear/io/httpget.cxx b/simgear/io/httpget.cxx index c52117a9..e10a29b4 100644 --- a/simgear/io/httpget.cxx +++ b/simgear/io/httpget.cxx @@ -1,16 +1,18 @@ #include #include +#include -#include // for STDOUT_FILENO #include #include + #include #include #include #include #include +#include using namespace simgear; using std::cout; @@ -126,14 +128,17 @@ int main(int argc, char* argv[]) if (colonPos >= 0) { proxyHost = proxy.substr(0, colonPos); proxyPort = strutils::to_int(proxy.substr(colonPos + 1)); - cout << proxyHost << " " << proxyPort << endl; } cl.setProxy(proxyHost, proxyPort, proxyAuth); } +#ifndef WIN32 + signal(SIGPIPE, SIG_IGN); +#endif + if (!outFile) { - outFile = new SGFile(STDOUT_FILENO); + outFile = new SGFile(fileno(stdout)); } if (url.empty()) { @@ -150,9 +155,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;