static Eina_Bool _url_complete_cb(void *data, int type, void *event_info) { Ecore_Con_Event_Url_Complete *url_complete = event_info; struct _request *req = ecore_con_url_data_get(url_complete->url_con); int nbytes = ecore_con_url_received_bytes_get(url_complete->url_con); printf("\n"); printf("download completed with status code: %d\n", url_complete->status); printf("Total size of downloaded file: %ld bytes\n", req->size); printf("Total size of downloaded file: %d bytes " "(from received_bytes_get)\n", nbytes); ecore_main_loop_quit(); return EINA_TRUE; }
static Eina_Bool _url_compl_cb(void *data, int type EINA_UNUSED, void *event_info) { url_test *info = data; Ecore_Con_Event_Url_Complete *ev = event_info; printf("Total downloaded bytes = %d\n", ecore_con_url_received_bytes_get(ev->url_con)); if (info->_tmpfd) { _free_url_test(info); ecore_con_url_free(ev->url_con); } else { fail_unless(ecore_con_url_url_set(ev->url_con, "ftp://ftp.kernel.org/pub/linux/kernel/README")); ecore_con_url_verbose_set (ev->url_con, EINA_FALSE); info->_tmpfd = eina_file_mkstemp("ecore_con_test_XXXXXX.html", &(info->_test_file)); if (info->_tmpfd < 0) { free(info); ecore_con_url_free(ev->url_con); fail(); } ecore_con_url_fd_set(ev->url_con, info->_tmpfd); if (!ecore_con_url_get(ev->url_con)) { _free_url_test(info); ecore_con_url_free(ev->url_con); fail(); } } return EINA_FALSE; }