return 0;
}
+int __progress_cb(void *user_data, double dltotal, double dlnow, double ultotal, double ulnow)
+{
+ __http_transaction_h *transaction = (__http_transaction_h *)user_data;
+
+ double total_download = dltotal;
+ double current_download = dlnow;
+ double total_upload = ultotal;
+ double current_upload = ulnow;
+
+ if (transaction->progress_cb)
+ transaction->progress_cb(transaction, total_download, current_download,
+ total_upload, current_upload, transaction->progress_user_data);
+
+ return 0;
+}
+
//LCOV_EXCL_START
int http_transaction_set_authentication_info(http_transaction_h http_transaction)
{
curl_easy_setopt(transaction->easy_handle, CURLOPT_READDATA, transaction);
}
+ curl_easy_setopt(transaction->easy_handle, CURLOPT_NOPROGRESS, FALSE);
+ curl_easy_setopt(transaction->easy_handle, CURLOPT_PROGRESSFUNCTION, __progress_cb);
+ curl_easy_setopt(transaction->easy_handle, CURLOPT_PROGRESSDATA, transaction);
+
curl_easy_setopt(transaction->easy_handle, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(transaction->easy_handle, CURLOPT_DEBUGFUNCTION, __http_debug_received);
curl_easy_setopt(transaction->easy_handle, CURLOPT_ERRORBUFFER, transaction->error);
DBG("aborted reason: %d\n", reason);
}
+void __transaction_progress_cb(http_transaction_h transaction, double download_total, double download_now, double upload_total, double upload_now, void *user_data)
+{
+ PRG("__transaction_progress_cb", transaction);
+ DBG("Download ====>: DOWN(%lf/%lf)\n", download_total, download_now);
+ DBG("Upload ====>: UP(%lf/%lf)\n", upload_total, upload_now);
+}
+
void _register_callbacks(http_transaction_h transaction)
{
http_transaction_set_received_header_cb(transaction, __transaction_header_cb, NULL);
http_transaction_set_uploaded_cb(transaction, __transaction_write_cb, NULL);
http_transaction_set_completed_cb(transaction, __transaction_completed_cb, NULL);
http_transaction_set_aborted_cb(transaction, __transaction_aborted_cb, NULL);
+ http_transaction_set_progress_cb(transaction, __transaction_progress_cb, NULL);
}
int test_http_init(void)