Introduces AIHTTPTimeoutPolicy objects which do not just specify a single "timeout" in seconds, but a plethora of timings related to the life cycle of the average HTTP transaction. This knowledge is that moved to the Responder being used instead of floating constants hardcoded in the callers of http requests. This assumes that the same timeout policy is wanted for each transaction that uses the same Responder, which can be enforced is needed. I added a AIHTTPTimeoutPolicy for EVERY responder, only to make it easier later to tune timeout values and/or to get feedback about which responder runs into HTTP errors in debug output (especially time outs), so that they can be tuned later. If we already understood exactly what we were doing then most responders could have been left alone and just return the default timeout policy: by far most timeout policies are just a copy of the default policy, currently. This commit is not finished... It's a work in progress (viewer runs fine with it though).
58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
/**
|
|
* @file llcurlrequest.h
|
|
* @brief Declaration of class Request
|
|
*
|
|
* Copyright (c) 2012, Aleric Inglewood.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* There are special exceptions to the terms and conditions of the GPL as
|
|
* it is applied to this Source Code. View the full text of the exception
|
|
* in the file doc/FLOSS-exception.txt in this software distribution.
|
|
*
|
|
* CHANGELOG
|
|
* and additional copyright holders.
|
|
*
|
|
* 17/03/2012
|
|
* Initial version, written by Aleric Inglewood @ SL
|
|
*/
|
|
|
|
#ifndef AICURLREQUEST_H
|
|
#define AICURLREQUEST_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <boost/intrusive_ptr.hpp>
|
|
|
|
class AIHTTPHeaders;
|
|
|
|
// Things defined in this namespace are called from elsewhere in the viewer code.
|
|
namespace AICurlInterface {
|
|
|
|
// Forward declaration.
|
|
class Responder;
|
|
typedef boost::intrusive_ptr<Responder> ResponderPtr;
|
|
|
|
class Request {
|
|
public:
|
|
bool get2(std::string const& url, ResponderPtr responder);
|
|
bool getByteRange2(std::string const& url, AIHTTPHeaders const& headers, S32 offset, S32 length, ResponderPtr responder);
|
|
bool post2(std::string const& url, AIHTTPHeaders const& headers, std::string const& data, ResponderPtr responder);
|
|
bool post3(std::string const& url, AIHTTPHeaders const& headers, LLSD const& data, ResponderPtr responder);
|
|
};
|
|
|
|
} // namespace AICurlInterface
|
|
|
|
#endif
|