Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-06-28 14:53:27 +0300
committerbubnikv <bubnikv@gmail.com>2018-06-28 14:53:27 +0300
commitacd712cdbc12797192e2b313097c44b7ba174b2a (patch)
treeb95bc5827f956ec662607dab2c08ff2ebbeb0505 /xs/src/slic3r/Utils/Http.cpp
parent67de1a462f3f7610c593942367570b365759e406 (diff)
parent5787c495d670a980ec5120c3740aa2470e4096a3 (diff)
Merge remote-tracking branch 'remotes/origin/vk-octoprint'
Diffstat (limited to 'xs/src/slic3r/Utils/Http.cpp')
-rw-r--r--xs/src/slic3r/Utils/Http.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/xs/src/slic3r/Utils/Http.cpp b/xs/src/slic3r/Utils/Http.cpp
index 949a0e7d6..37eb59a00 100644
--- a/xs/src/slic3r/Utils/Http.cpp
+++ b/xs/src/slic3r/Utils/Http.cpp
@@ -202,7 +202,6 @@ std::string Http::priv::body_size_error()
void Http::priv::http_perform()
{
- ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
::curl_easy_setopt(curl, CURLOPT_WRITEDATA, static_cast<void*>(this));
@@ -231,8 +230,6 @@ void Http::priv::http_perform()
}
CURLcode res = ::curl_easy_perform(curl);
- long http_status = 0;
- ::curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status);
if (res != CURLE_OK) {
if (res == CURLE_ABORTED_BY_CALLBACK) {
@@ -243,17 +240,22 @@ void Http::priv::http_perform()
if (progressfn) { progressfn(dummyprogress, cancel); }
} else {
// The abort comes from the CURLOPT_READFUNCTION callback, which means reading file failed
- if (errorfn) { errorfn(std::move(buffer), "Error reading file for file upload", http_status); }
+ if (errorfn) { errorfn(std::move(buffer), "Error reading file for file upload", 0); }
}
}
else if (res == CURLE_WRITE_ERROR) {
- if (errorfn) { errorfn(std::move(buffer), body_size_error(), http_status); }
+ if (errorfn) { errorfn(std::move(buffer), body_size_error(), 0); }
} else {
- if (errorfn) { errorfn(std::move(buffer), curl_error(res), http_status); }
+ if (errorfn) { errorfn(std::move(buffer), curl_error(res), 0); }
};
} else {
- if (completefn) {
- completefn(std::move(buffer), http_status);
+ long http_status = 0;
+ ::curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status);
+
+ if (http_status >= 400) {
+ if (errorfn) { errorfn(std::move(buffer), std::string(), http_status); }
+ } else {
+ if (completefn) { completefn(std::move(buffer), http_status); }
}
}
}