code:Защита
Этот коммит содержится в:
@@ -39,7 +39,7 @@ static size_t write_data(void* items, size_t item_size, size_t item_count, void*
|
||||
Input download(const string& address) {
|
||||
stringstream buffer;
|
||||
CURL* curl = curl_easy_init();
|
||||
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||
@@ -49,6 +49,11 @@ Input download(const string& address) {
|
||||
curl_easy_cleanup(curl);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
double download_speed = 0.0;
|
||||
curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &download_speed);
|
||||
cerr << "Download speed: " << download_speed << " bytes/sec\n";
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
return input_data(buffer, false);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user