]> git.mxchange.org Git - simgear.git/blobdiff - simgear/io/httpget.cxx
cppbind.Ghost: clean up a bit
[simgear.git] / simgear / io / httpget.cxx
index e10a29b41659dd3fc992b77358296ca5d40ce65b..876ba14ff9aa9f4bf52cc882db99d30a8be54153 100644 (file)
@@ -12,7 +12,7 @@
 #include <simgear/io/HTTPRequest.hxx>
 #include <simgear/io/sg_netChannel.hxx>
 #include <simgear/misc/strutils.hxx>
-#include <simgear/misc/sg_sleep.hxx>
+#include <simgear/timing/timestamp.hxx>
 
 using namespace simgear;
 using std::cout;
@@ -48,35 +48,11 @@ public:
         }
         
         string key = h.substr(0, colonPos);
-        _headers[key] = h.substr(colonPos + 1);
+        requestHeader(key) = h.substr(colonPos + 1);
     }
     
-    virtual string_list requestHeaders() const
-    {
-        string_list r;
-        std::map<string, string>::const_iterator it;
-        for (it = _headers.begin(); it != _headers.end(); ++it) {
-            r.push_back(it->first);
-        }
-        
-        return r;
-    }
-    
-    virtual string header(const string& name) const
-    {
-        std::map<string, string>::const_iterator it = _headers.find(name);
-        if (it == _headers.end()) {
-            return string();
-        }
-        
-        return it->second;
-    }
 protected:
-    virtual void responseHeadersComplete()
-    {
-    }
-
-    virtual void responseComplete()
+    virtual void onDone()
     {
         _complete = true;
     }  
@@ -88,13 +64,12 @@ protected:
 private:    
     bool _complete;
     SGFile* _file;
-    std::map<string, string> _headers;
 };
 
 int main(int argc, char* argv[])
 {
     HTTP::Client cl;
-    SGFile* outFile;
+    SGFile* outFile = 0;
     string proxy, proxyAuth;
     string_list headers;
     string url;
@@ -156,7 +131,7 @@ int main(int argc, char* argv[])
     
     while (!req->complete()) {
         cl.update();
-        sleepForMSec(100);
+        SGTimeStamp::sleepForMSec(100);
     }
         
     if (req->responseCode() != 200) {