Added continue / resume download support for HTTP Requests.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-05-10 00:40:43 -03:00
parent 39ec343096
commit cf281eaa12
3 changed files with 62 additions and 3 deletions

View File

@@ -168,6 +168,12 @@ class EE_API Http : NonCopyable {
*/
void setCompressedResponse(const bool& compressedResponse);
/** Resumes download if a file is already present */
void setContinue(const bool& resume);
/** @return If must continue a download previously started. */
const bool& isContinue() const;
private:
friend class Http;
@@ -194,6 +200,7 @@ class EE_API Http : NonCopyable {
bool mValidateHostname; ///< Validates the hostname in case of an HTTPS request
bool mFollowRedirect; ///< Follows redirect response codes
bool mCompressedResponse; ///< Request comrpessed response
bool mContinue; ///< Resume download
mutable bool mCancel; ///< Cancel state of current request
ProgressCallback mProgressCallback; ///< Progress callback
unsigned int mMaxRedirections; ///< Maximun number of redirections allowed
@@ -261,6 +268,9 @@ class EE_API Http : NonCopyable {
** @return Value of the field, or empty string if not found */
const std::string& getField(const std::string& field) const;
/** @return If the field is found in the response headers. */
bool hasField(const std::string& field) const;
/** @brief Get the response status code
** The status code should be the first thing to be checked
** after receiving a response, it defines whether it is a