main
SavinSA 1 год назад
Родитель d58498056a
Сommit 0c62539a69

@ -67,6 +67,7 @@ download(const string& address) {
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
if (curl) { if (curl) {
CURLcode res; CURLcode res;
curl_off_t connect;
curl_easy_setopt(curl, CURLOPT_URL, address.c_str()); curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
@ -75,6 +76,12 @@ download(const string& address) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
exit(1); exit(1);
} }
if (CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
if (CURLE_OK == res) {
fprintf(stderr, "connection time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000, (long)(connect % 1000000));
}
}
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} }
return input_data(buffer, false); return input_data(buffer, false);

Загрузка…
Отмена
Сохранить