From 4652719267896f3d8cd054344b715491a4a8a234 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 7 Mar 2012 17:15:01 +0000 Subject: [PATCH] added ecore_con_url_status_code_get, cleaned up recent changelog/news entries, zero http status on new transfers SVN revision: 69009 --- legacy/ecore/ChangeLog | 12 ++++++---- legacy/ecore/NEWS | 3 ++- legacy/ecore/src/lib/ecore_con/Ecore_Con.h | 10 ++++++++ .../ecore/src/lib/ecore_con/ecore_con_url.c | 24 +++++++++++++++++++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index e4702a7f48..ad6662acef 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -554,11 +554,15 @@ 2012-03-07 ChunEon Park (Hermet) * Add ecore_x_illume_clipboard_state_set() - ecore_x_illume_clipboard_state_get() - ecore_x_illume_clipboard_geometry_set() - ecore_x_illume_clipboard_geometry_get() + ecore_x_illume_clipboard_state_get() + ecore_x_illume_clipboard_geometry_set() + ecore_x_illume_clipboard_geometry_get() -2012-03-07 Carsten Haitzler (The Rasterman) +2012-03-07 Carsten Haitzler (The Rasterman) * Add atoms and api for rotation and indicator transparency in ecore_x/ecore_evas + +2012-03-07 Mike Blumenkrantz (discomfitor/zmike) + + * Add ecore_con_url_status_code_get() to check return code at any time diff --git a/legacy/ecore/NEWS b/legacy/ecore/NEWS index 5dc12a62d2..346bc0bc06 100644 --- a/legacy/ecore/NEWS +++ b/legacy/ecore/NEWS @@ -13,9 +13,10 @@ Additions: - ECORE_CON_REMOTE_CORK - ecore_con_url_proxy_set() - ecore_con_url_timeout_set() - - ecore_con_url_proxy_username_set + - ecore_con_url_proxy_username_set() - ecore_con_url_proxy_password_set() - ecore_con_url_http_version_set() + - ecore_con_url_status_code_get() * ecore_x: - ecore_x_randr_output_backlight_available() - ecore_x_randr_window_crtcs_get() diff --git a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h index 0bf2b6f683..9a67fdc80e 100644 --- a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h +++ b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h @@ -1917,6 +1917,16 @@ EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const ch */ EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout); +/** + * Get the returned HTTP STATUS code + * + * This is used to, at any time, try to return the status code for a transmission. + * @param url_con Connection object + * @return A valid HTTP STATUS code, or -1 on failure + * + * @since 1.2 + */ +EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con); /** * @} */ diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con_url.c b/legacy/ecore/src/lib/ecore_con/ecore_con_url.c index 90e84470a8..c52978b040 100644 --- a/legacy/ecore/src/lib/ecore_con/ecore_con_url.c +++ b/legacy/ecore/src/lib/ecore_con/ecore_con_url.c @@ -48,6 +48,7 @@ static void _ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev); static Eina_Bool _ecore_con_url_timer(void *data); static Eina_Bool _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); static Eina_Bool _ecore_con_url_timeout_cb(void *data); +static void _ecore_con_url_status_get(Ecore_Con_Url *url_con); static Eina_List *_url_con_list = NULL; static Eina_List *_fd_hd_list = NULL; @@ -360,6 +361,24 @@ ecore_con_url_url_get(Ecore_Con_Url *url_con) #endif } +EAPI int +ecore_con_url_status_code_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__); + return -1; + } + + _ecore_con_url_status_get(url_con); + return url_con->status ?: -1; +#else + return -1; + (void)url_con; +#endif +} + EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url) { @@ -620,6 +639,7 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long len EINA_LIST_FREE(url_con->response_headers, s) free((char *)s); url_con->response_headers = NULL; + url_con->status = 0; curl_slist_free_all(url_con->headers); url_con->headers = NULL; @@ -1270,8 +1290,12 @@ static void _ecore_con_url_status_get(Ecore_Con_Url *url_con) { long status = 0; + + if (!url_con->curl_easy) return; if (curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status)) url_con->status = status; + else + url_con->status = 0; } static void