diff --git a/cs-lab34.layout b/cs-lab34.layout
index 9a132fb..6e12ffa 100644
--- a/cs-lab34.layout
+++ b/cs-lab34.layout
@@ -2,24 +2,24 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/main.cpp b/main.cpp
index 758a15b..87f6c74 100644
--- a/main.cpp
+++ b/main.cpp
@@ -51,37 +51,34 @@ size_t write_data(void* items, size_t item_size, size_t item_count, void* ctx) {
return data_size;
}
-
Input download(const string& address) {
-
stringstream buffer;
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode res;
+ double connect_time;
- curl_global_init(CURL_GLOBAL_ALL);
-
- CURL* curl = curl_easy_init(); // CURL* - дескриптор, сложный объект, передавать их функциям библиотеки и сравнивать между собой
+ curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
+ res = curl_easy_perform(curl);
- if(curl) {
- CURLcode res;
- curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); // библиотека может вызывать функцию, которую укажет программа.
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
- res = curl_easy_perform(curl);
+ if (!curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect_time)) {
+ cerr << "Connect time: " << connect_time << " seconds." << endl;
+ } else {
+ cerr << "Failed to retrieve connect time." << endl;
+ }
- if (res != CURLE_OK) {
- curl_easy_strerror(res);
- exit(1);
- }
- if(!res) {
- long req;
- res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &req);
- if(!res) {
- cerr<<"Request size: "<