2 * \file HTTPClient.hxx - simple HTTP client engine for SimHear
5 // Written by James Turner
7 // Copyright (C) 2013 James Turner <zakalawe@mac.com>
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Library General Public
11 // License as published by the Free Software Foundation; either
12 // version 2 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Library General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef SG_HTTP_CLIENT_HXX
25 #define SG_HTTP_CLIENT_HXX
27 #include <simgear/io/HTTPRequest.hxx>
44 void update(int waitTimeout = 0);
46 void makeRequest(const Request_ptr& r);
48 void setUserAgent(const std::string& ua);
49 void setProxy(const std::string& proxy, int port, const std::string& auth = "");
52 * Specify the maximum permitted simultaneous connections
53 * (default value is 1)
55 void setMaxConnections(unsigned int maxCons);
57 const std::string& userAgent() const;
59 const std::string& proxyHost() const;
61 const std::string& proxyAuth() const;
64 * predicate, check if at least one connection is active, with at
65 * least one request active or queued.
67 bool hasActiveRequests() const;
69 void requestFinished(Connection* con);
71 friend class Connection;
75 std::auto_ptr<ClientPrivate> d;
78 } // of namespace HTTP
80 } // of namespace simgear
82 #endif // of SG_HTTP_CLIENT_HXX