check return code on CURLINFO_RESPONSE_CODE and add helper function for it
SVN revision: 69008
This commit is contained in:
parent
8217a140a0
commit
894bfaeed7
|
@ -207,6 +207,7 @@ struct _Ecore_Con_Url
|
||||||
Eina_List *response_headers;
|
Eina_List *response_headers;
|
||||||
const char *url;
|
const char *url;
|
||||||
long proxy_type;
|
long proxy_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
Ecore_Timer *timer;
|
Ecore_Timer *timer;
|
||||||
|
|
||||||
|
|
|
@ -1266,20 +1266,30 @@ ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
static void
|
||||||
|
_ecore_con_url_status_get(Ecore_Con_Url *url_con)
|
||||||
|
{
|
||||||
|
long status = 0;
|
||||||
|
if (curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status))
|
||||||
|
url_con->status = status;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg)
|
_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Url_Complete *e;
|
Ecore_Con_Event_Url_Complete *e;
|
||||||
long status = 0;
|
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
|
e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
|
|
||||||
if (curlmsg && (curlmsg->data.result == CURLE_OK))
|
if (curlmsg && (curlmsg->data.result == CURLE_OK))
|
||||||
curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &status);
|
{
|
||||||
|
if (!url_con->status)
|
||||||
|
_ecore_con_url_status_get(url_con);
|
||||||
|
}
|
||||||
else ERR("Curl message have errors: %d", curlmsg->data.result);
|
else ERR("Curl message have errors: %d", curlmsg->data.result);
|
||||||
|
|
||||||
e->status = status;
|
e->status = url_con->status;
|
||||||
e->url_con = url_con;
|
e->url_con = url_con;
|
||||||
url_con->event_count++;
|
url_con->event_count++;
|
||||||
ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
|
ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
|
||||||
|
|
Loading…
Reference in New Issue