diff options
Diffstat (limited to 'xs/src/slic3r/Utils/Http.hpp')
-rw-r--r-- | xs/src/slic3r/Utils/Http.hpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xs/src/slic3r/Utils/Http.hpp b/xs/src/slic3r/Utils/Http.hpp index 73656bf88..ce4e438ca 100644 --- a/xs/src/slic3r/Utils/Http.hpp +++ b/xs/src/slic3r/Utils/Http.hpp @@ -29,7 +29,16 @@ public: typedef std::shared_ptr<Http> Ptr; typedef std::function<void(std::string /* body */, unsigned /* http_status */)> CompleteFn; + + // A HTTP request may fail at various stages of completeness (URL parsing, DNS lookup, TCP connection, ...). + // If the HTTP request could not be made or failed before completion, the `error` arg contains a description + // of the error and `http_status` is zero. + // If the HTTP request was completed but the response HTTP code is >= 400, `error` is empty and `http_status` contains the response code. + // In either case there may or may not be a body. typedef std::function<void(std::string /* body */, std::string /* error */, unsigned /* http_status */)> ErrorFn; + + // See the Progress struct above. + // Writing true to the `cancel` reference cancels the request in progress. typedef std::function<void(Progress, bool& /* cancel */)> ProgressFn; Http(Http &&other); @@ -46,7 +55,8 @@ public: Http& operator=(const Http &) = delete; Http& operator=(Http &&) = delete; - // Sets a maximum size of the data that can be received. The default is 5MB. + // Sets a maximum size of the data that can be received. + // A value of zero sets the default limit, which is is 5MB. Http& size_limit(size_t sizeLimit); // Sets a HTTP header field. Http& header(std::string name, const std::string &value); |