]> git.mxchange.org Git - simgear.git/blob - simgear/io/HTTPClient.hxx
Tweaks to HTTP code, in preparation for using it for metar - especially, test code...
[simgear.git] / simgear / io / HTTPClient.hxx
1 #ifndef SG_HTTP_CLIENT_HXX
2 #define SG_HTTP_CLIENT_HXX
3
4 #include <map>
5
6 #include <simgear/io/HTTPRequest.hxx>
7
8 namespace simgear
9 {
10
11 namespace HTTP
12 {
13
14 class Connection;
15
16 class Client
17 {
18 public:
19     Client();
20     
21     void update();
22     
23     void makeRequest(const Request_ptr& r);
24     
25     void setUserAgent(const std::string& ua);
26     void setProxy(const std::string& proxy, const std::string& auth = "");
27     
28     const std::string& userAgent() const
29         { return _userAgent; }
30         
31     const std::string& proxyHost() const
32         { return _proxy; }
33         
34     const std::string& proxyAuth() const
35         { return _proxyAuth; }
36 private:
37     void requestFinished(Connection* con);
38     
39     friend class Connection;
40     
41     std::string _userAgent;
42     std::string _proxy;
43     std::string _proxyAuth;
44     
45 // connections by host
46     typedef std::map<std::string, Connection*> ConnectionDict;
47     ConnectionDict _connections;
48 };
49
50 } // of namespace HTTP
51
52 } // of namespace simgear
53
54 #endif // of SG_HTTP_CLIENT_HXX