Commit f69a36fd authored by Paweł Wegner's avatar Paweł Wegner
Browse files

IHttp: removed receivedCode and receivedLength callbacks.

parent 294b71a1
......@@ -75,20 +75,6 @@ class IHttpRequest {
* @param now count of bytes uploaded
*/
virtual void progressUpload(uint32_t total, uint32_t now) = 0;
/**
* Called when response's http code was received.
*
* @param code received http code
*/
virtual void receivedHttpCode(int code) = 0;
/**
* Called when response's Content-Length header was received.
*
* @param length Content-Length
*/
virtual void receivedContentLength(int length) = 0;
};
/**
......
......@@ -43,8 +43,4 @@ void HttpCallback::progressUpload(uint32_t total, uint32_t now) {
if (progress_upload_) progress_upload_(total, now);
}
void HttpCallback::receivedHttpCode(int) {}
void HttpCallback::receivedContentLength(int) {}
} // namespace cloudstorage
......@@ -42,10 +42,6 @@ class HttpCallback : public IHttpRequest::ICallback {
void progressUpload(uint32_t, uint32_t) override;
void receivedHttpCode(int) override;
void receivedContentLength(int) override;
private:
std::function<bool()> is_cancelled_;
std::function<void(uint32_t, uint32_t)> progress_download_;
......
......@@ -46,12 +46,7 @@ size_t write_callback(char* ptr, size_t size, size_t nmemb, void* userdata) {
long http_code = 0;
curl_easy_getinfo(data->handle_.get(), CURLINFO_RESPONSE_CODE,
&http_code);
data->callback_->receivedHttpCode(static_cast<int>(http_code));
data->success_ = IHttpRequest::isSuccess(static_cast<int>(http_code));
double content_length = 0;
curl_easy_getinfo(data->handle_.get(), CURLINFO_CONTENT_LENGTH_DOWNLOAD,
&content_length);
data->callback_->receivedContentLength(static_cast<int>(content_length));
}
}
if (!data->error_stream_ || data->success_)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment