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:
Julian Smith
2021-02-18 09:30:56 +00:00
parent 7f83686853
commit f9ecf455ba
5 changed files with 115 additions and 7 deletions
+6
View File
@@ -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()
{