simgear/io/: exteded http client support to allow replaying of recordings from a URL.
simgear/io/HTTPClient.cxx
Support range in HTTPRequest's. Set CURLOPT_MAX_RECV_SPEED_LARGE if request's
getMaxBytesPerSec() is non-zero.
simgear/io/HTTPFileRequest.cxx
simgear/io/HTTPFileRequest.hxx
Added 'bool append' to constructor args; if specified we assume that, if
the output file already exists, it is from an interrupted download, and we
use an http Range header to append any remaining data.
Support a std::function callback when new data is available.
Added setMaxBytesPerSec() to limit download bandwidth; useful for testing.
simgear/io/HTTPRequest.cxx
simgear/io/HTTPRequest.hxx
Added support for setting Range header.
In both simgear/io/HTTPClient.cxx and simgear/io/HTTPRequest.cxx, if
a range is specified, we treat http results 206 'Partial Content' and
416 'Range Not Satisfiable' as success.
This commit is contained in:
@@ -127,6 +127,12 @@ void Request::setUrl(const std::string& url)
|
||||
_url = url;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Request::setRange(const std::string& range)
|
||||
{
|
||||
_range = range;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Request::requestStart()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user