forked from enlightenment/efl
revert all recent ecore-con related eo changes. completely broken.
please test things before committing.
reverts all changes since and including f6156c9a62
This commit is contained in:
parent
44326f9ed8
commit
7b0db79c2d
|
@ -7,27 +7,19 @@ ecorecon_eobuiltheaders = \
|
||||||
lib/ecore_con/ecore_con_client.eo.h \
|
lib/ecore_con/ecore_con_client.eo.h \
|
||||||
lib/ecore_con/ecore_con_client.eo.legacy.h \
|
lib/ecore_con/ecore_con_client.eo.legacy.h \
|
||||||
lib/ecore_con/ecore_con_server.eo.h \
|
lib/ecore_con/ecore_con_server.eo.h \
|
||||||
lib/ecore_con/ecore_con_server.eo.legacy.h \
|
lib/ecore_con/ecore_con_server.eo.legacy.h
|
||||||
lib/ecore_con/ecore_con_connector.eo.h \
|
|
||||||
lib/ecore_con/ecore_con_connector.eo.legacy.h \
|
|
||||||
lib/ecore_con/ecore_con_url.eo.h \
|
|
||||||
lib/ecore_con/ecore_con_url.eo.legacy.h
|
|
||||||
|
|
||||||
BUILT_SOURCES += \
|
BUILT_SOURCES += \
|
||||||
${ecorecon_eobuiltheaders} \
|
${ecorecon_eobuiltheaders} \
|
||||||
lib/ecore_con/ecore_con_base.eo.c \
|
lib/ecore_con/ecore_con_base.eo.c \
|
||||||
lib/ecore_con/ecore_con_client.eo.c \
|
lib/ecore_con/ecore_con_client.eo.c \
|
||||||
lib/ecore_con/ecore_con_server.eo.c \
|
lib/ecore_con/ecore_con_server.eo.c
|
||||||
lib/ecore_con/ecore_con_connector.eo.c \
|
|
||||||
lib/ecore_con/ecore_con_url.eo.c
|
|
||||||
|
|
||||||
ecoreconeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
ecoreconeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
||||||
ecoreconeolianfiles_DATA = \
|
ecoreconeolianfiles_DATA = \
|
||||||
lib/ecore_con/ecore_con_base.eo \
|
lib/ecore_con/ecore_con_base.eo \
|
||||||
lib/ecore_con/ecore_con_client.eo \
|
lib/ecore_con/ecore_con_client.eo \
|
||||||
lib/ecore_con/ecore_con_server.eo \
|
lib/ecore_con/ecore_con_server.eo
|
||||||
lib/ecore_con/ecore_con_connector.eo \
|
|
||||||
lib/ecore_con/ecore_con_url.eo
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
${ecoreconeolianfiles_DATA}
|
${ecoreconeolianfiles_DATA}
|
||||||
|
|
|
@ -232,7 +232,12 @@ typedef Eo Ecore_Con;
|
||||||
*/
|
*/
|
||||||
typedef struct Ecore_Con_Socks Ecore_Con_Socks;
|
typedef struct Ecore_Con_Socks Ecore_Con_Socks;
|
||||||
|
|
||||||
typedef enum _Ecore_Con_Type Ecore_Con_Type;
|
/**
|
||||||
|
* @typedef Ecore_Con_Url
|
||||||
|
* A handle to an http upload/download object
|
||||||
|
* @ingroup Ecore_Con_Url_Group
|
||||||
|
*/
|
||||||
|
typedef struct _Ecore_Con_Url Ecore_Con_Url;
|
||||||
|
|
||||||
#ifndef EFL_NOLEGACY_API_SUPPORT
|
#ifndef EFL_NOLEGACY_API_SUPPORT
|
||||||
#include "Ecore_Con_Legacy.h"
|
#include "Ecore_Con_Legacy.h"
|
||||||
|
@ -1392,7 +1397,25 @@ EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url,
|
||||||
* @see ecore_con_url_new()
|
* @see ecore_con_url_new()
|
||||||
*/
|
*/
|
||||||
EAPI void ecore_con_url_free(Ecore_Con_Url *url_con);
|
EAPI void ecore_con_url_free(Ecore_Con_Url *url_con);
|
||||||
|
/**
|
||||||
|
* Sets the URL to send the request to.
|
||||||
|
*
|
||||||
|
* @param url_con Connection object through which the request will be sent.
|
||||||
|
* @param url URL that will receive the request
|
||||||
|
*
|
||||||
|
* @return @c EINA_TRUE on success, @c EINA_FALSE on error.
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con,
|
||||||
|
const char *url);
|
||||||
|
/**
|
||||||
|
* Gets the URL to send the request to.
|
||||||
|
*
|
||||||
|
* @param url_con Connection object through which the request will be sent.
|
||||||
|
* @return URL that will receive the request, @c NULL on failure. URL is
|
||||||
|
* stringshared.
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
EAPI const char *ecore_con_url_url_get(Ecore_Con_Url *url_con);
|
||||||
/**
|
/**
|
||||||
* Associates data with a connection object.
|
* Associates data with a connection object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#include "ecore_con_base.eo.h"
|
#include "ecore_con_base.eo.h"
|
||||||
#include "ecore_con_server.eo.h"
|
#include "ecore_con_server.eo.h"
|
||||||
#include "ecore_con_connector.eo.h"
|
|
||||||
#include "ecore_con_client.eo.h"
|
#include "ecore_con_client.eo.h"
|
||||||
#include "ecore_con_url.eo.h"
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#include "ecore_con_base.eo.legacy.h"
|
#include "ecore_con_base.eo.legacy.h"
|
||||||
#include "ecore_con_server.eo.legacy.h"
|
#include "ecore_con_server.eo.legacy.h"
|
||||||
#include "ecore_con_connector.eo.legacy.h"
|
|
||||||
#include "ecore_con_client.eo.legacy.h"
|
#include "ecore_con_client.eo.legacy.h"
|
||||||
#include "ecore_con_url.eo.legacy.h"
|
|
||||||
|
|
|
@ -107,14 +107,6 @@ static void _ecore_con_lookup_done(void *data,
|
||||||
|
|
||||||
static const char *_ecore_con_pretty_ip(struct sockaddr *client_addr);
|
static const char *_ecore_con_pretty_ip(struct sockaddr *client_addr);
|
||||||
|
|
||||||
#define EO_CONSTRUCTOR_CHECK_RETURN(obj) do { \
|
|
||||||
if (eo_do(obj, eo_finalized_get())) \
|
|
||||||
{ \
|
|
||||||
ERR("This function is only allowed during construction."); \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_SYSTEMD
|
||||||
int sd_fd_index = 0;
|
int sd_fd_index = 0;
|
||||||
int sd_fd_max = 0;
|
int sd_fd_max = 0;
|
||||||
|
@ -290,10 +282,7 @@ _ecore_con_base_lookup(Eo *kls_obj EINA_UNUSED, void *pd EINA_UNUSED, const char
|
||||||
if (!name || !done_cb)
|
if (!name || !done_cb)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
obj = eo_add(ECORE_CON_SERVER_CLASS, NULL,
|
obj = eo_add(ECORE_CON_SERVER_CLASS, NULL);
|
||||||
ecore_con_server_obj_connection_type_set(ECORE_CON_REMOTE_TCP),
|
|
||||||
ecore_con_server_obj_name_set(name),
|
|
||||||
ecore_con_obj_port_set(1025));
|
|
||||||
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
|
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
|
||||||
if (!svr)
|
if (!svr)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -312,7 +301,14 @@ _ecore_con_base_lookup(Eo *kls_obj EINA_UNUSED, void *pd EINA_UNUSED, const char
|
||||||
if (!svr->name)
|
if (!svr->name)
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
|
||||||
|
svr->type = ECORE_CON_REMOTE_TCP;
|
||||||
|
svr->port = 1025;
|
||||||
svr->data = lk;
|
svr->data = lk;
|
||||||
|
svr->created = EINA_TRUE;
|
||||||
|
svr->reject_excess_clients = EINA_FALSE;
|
||||||
|
svr->client_limit = -1;
|
||||||
|
svr->clients = NULL;
|
||||||
|
svr->ppid = getpid();
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(struct addrinfo));
|
memset(&hints, 0, sizeof(struct addrinfo));
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
@ -354,53 +350,39 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
Ecore_Con_Server *obj;
|
Ecore_Con_Server *obj;
|
||||||
|
Ecore_Con_Type type;
|
||||||
|
|
||||||
|
if (port < 0 || !name)
|
||||||
|
return NULL; /* local user socket: FILE: ~/.ecore/[name]/[port] */
|
||||||
|
|
||||||
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
|
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
|
||||||
/* remote system socket: TCP/IP: [name]:[port] */
|
/* remote system socket: TCP/IP: [name]:[port] */
|
||||||
obj = eo_add(ECORE_CON_SERVER_CLASS, NULL,
|
obj = eo_add(ECORE_CON_SERVER_CLASS, NULL);
|
||||||
ecore_con_server_obj_connection_type_set(compl_type),
|
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
|
||||||
ecore_con_server_obj_name_set(name),
|
|
||||||
ecore_con_obj_port_set(port));
|
|
||||||
|
|
||||||
ecore_con_server_data_set(obj, (void *) data);
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_ecore_con_server_eo_base_constructor(Ecore_Con_Server *obj, Ecore_Con_Server_Data *svr)
|
|
||||||
{
|
|
||||||
eo_do_super(obj, ECORE_CON_SERVER_CLASS, eo_constructor());
|
|
||||||
|
|
||||||
svr->fd = -1;
|
svr->fd = -1;
|
||||||
svr->start_time = ecore_time_get();
|
svr->start_time = ecore_time_get();
|
||||||
|
svr->type = compl_type;
|
||||||
|
svr->port = port;
|
||||||
|
svr->data = (void *)data;
|
||||||
svr->created = EINA_TRUE;
|
svr->created = EINA_TRUE;
|
||||||
|
svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
|
||||||
svr->reject_excess_clients = EINA_FALSE;
|
svr->reject_excess_clients = EINA_FALSE;
|
||||||
svr->client_limit = -1;
|
svr->client_limit = -1;
|
||||||
svr->clients = NULL;
|
svr->clients = NULL;
|
||||||
svr->ppid = getpid();
|
svr->ppid = getpid();
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eo *
|
|
||||||
_ecore_con_server_eo_base_finalize(Ecore_Con_Server *obj, Ecore_Con_Server_Data *svr)
|
|
||||||
{
|
|
||||||
Ecore_Con_Type compl_type = svr->type;
|
|
||||||
Ecore_Con_Type type;
|
|
||||||
|
|
||||||
eo_do_super(obj, ECORE_CON_SERVER_CLASS, eo_finalize());
|
|
||||||
|
|
||||||
svr->use_cert = (svr->type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
|
|
||||||
|
|
||||||
servers = eina_list_append(servers, obj);
|
servers = eina_list_append(servers, obj);
|
||||||
|
|
||||||
type = compl_type & ECORE_CON_TYPE;
|
svr->name = strdup(name);
|
||||||
|
|
||||||
if (!svr->name)
|
if (!svr->name)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (ecore_con_ssl_server_prepare(obj, compl_type & ECORE_CON_SSL))
|
if (ecore_con_ssl_server_prepare(obj, compl_type & ECORE_CON_SSL))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
type = compl_type & ECORE_CON_TYPE;
|
||||||
|
|
||||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||||
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
||||||
(type == ECORE_CON_LOCAL_ABSTRACT))
|
(type == ECORE_CON_LOCAL_ABSTRACT))
|
||||||
|
@ -444,36 +426,31 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
Ecore_Con_Server *obj;
|
Ecore_Con_Server *obj;
|
||||||
|
Ecore_Con_Type type;
|
||||||
|
|
||||||
|
if ((!name) || (!name[0]))
|
||||||
|
return NULL;
|
||||||
/* local user socket: FILE: ~/.ecore/[name]/[port] */
|
/* local user socket: FILE: ~/.ecore/[name]/[port] */
|
||||||
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
|
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
|
||||||
/* remote system socket: TCP/IP: [name]:[port] */
|
/* remote system socket: TCP/IP: [name]:[port] */
|
||||||
obj = eo_add(ECORE_CON_CONNECTOR_CLASS, NULL,
|
obj = eo_add(ECORE_CON_SERVER_CLASS, NULL);
|
||||||
ecore_con_server_obj_connection_type_set(compl_type),
|
|
||||||
ecore_con_server_obj_name_set(name),
|
|
||||||
ecore_con_obj_port_set(port));
|
|
||||||
|
|
||||||
ecore_con_server_data_set(obj, (void *) data);
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eo *
|
|
||||||
_ecore_con_connector_eo_base_finalize(Ecore_Con_Server *obj, void *pd EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
|
Ecore_Con_Server_Data *svr = eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
|
||||||
Ecore_Con_Type compl_type = svr->type;
|
|
||||||
Ecore_Con_Type type;
|
|
||||||
|
|
||||||
/* XXX: We intentionally put SERVER class here and not connector, as we'd
|
|
||||||
* like to skip that one. */
|
|
||||||
eo_do_super(obj, ECORE_CON_SERVER_CLASS, eo_finalize());
|
|
||||||
|
|
||||||
|
|
||||||
|
svr->fd = -1;
|
||||||
|
svr->type = compl_type;
|
||||||
|
svr->port = port;
|
||||||
|
svr->data = (void *)data;
|
||||||
|
svr->created = EINA_FALSE;
|
||||||
svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
|
svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
|
||||||
svr->disable_proxy = (compl_type & ECORE_CON_SUPER_SSL & ECORE_CON_NO_PROXY) == ECORE_CON_NO_PROXY;
|
svr->disable_proxy = (compl_type & ECORE_CON_SUPER_SSL & ECORE_CON_NO_PROXY) == ECORE_CON_NO_PROXY;
|
||||||
|
svr->reject_excess_clients = EINA_FALSE;
|
||||||
|
svr->clients = NULL;
|
||||||
|
svr->client_limit = -1;
|
||||||
|
|
||||||
servers = eina_list_append(servers, obj);
|
servers = eina_list_append(servers, obj);
|
||||||
|
|
||||||
if (!svr->name || (svr->port < 0))
|
svr->name = strdup(name);
|
||||||
|
if (!svr->name)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
type = compl_type & ECORE_CON_TYPE;
|
type = compl_type & ECORE_CON_TYPE;
|
||||||
|
@ -502,7 +479,7 @@ _ecore_con_connector_eo_base_finalize(Ecore_Con_Server *obj, void *pd EINA_UNUSE
|
||||||
(type == ECORE_CON_REMOTE_CORK) ||
|
(type == ECORE_CON_REMOTE_CORK) ||
|
||||||
(type == ECORE_CON_REMOTE_UDP) ||
|
(type == ECORE_CON_REMOTE_UDP) ||
|
||||||
(type == ECORE_CON_REMOTE_BROADCAST)) &&
|
(type == ECORE_CON_REMOTE_BROADCAST)) &&
|
||||||
(svr->port < 0), error);
|
(port < 0), error);
|
||||||
|
|
||||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||||
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
||||||
|
@ -617,31 +594,6 @@ _ecore_con_server_clients_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
||||||
return svr->clients;
|
return svr->clients;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_ecore_con_server_connection_type_set(Eo *obj, Ecore_Con_Server_Data *svr, Ecore_Con_Type type)
|
|
||||||
{
|
|
||||||
EO_CONSTRUCTOR_CHECK_RETURN(obj);
|
|
||||||
|
|
||||||
svr->type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Ecore_Con_Type
|
|
||||||
_ecore_con_server_connection_type_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
|
||||||
{
|
|
||||||
return svr->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_ecore_con_server_name_set(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr, const char *name)
|
|
||||||
{
|
|
||||||
EO_CONSTRUCTOR_CHECK_RETURN(obj);
|
|
||||||
|
|
||||||
if (svr->name)
|
|
||||||
free(svr->name);
|
|
||||||
|
|
||||||
svr->name = strdup(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static const char *
|
EOLIAN static const char *
|
||||||
_ecore_con_server_name_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
_ecore_con_server_name_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
||||||
{
|
{
|
||||||
|
@ -654,14 +606,6 @@ ecore_con_server_port_get(const Ecore_Con *obj)
|
||||||
return eo_do((Ecore_Con *)obj, ecore_con_obj_port_get());
|
return eo_do((Ecore_Con *)obj, ecore_con_obj_port_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_ecore_con_server_ecore_con_base_port_set(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr, int port)
|
|
||||||
{
|
|
||||||
EO_CONSTRUCTOR_CHECK_RETURN(obj);
|
|
||||||
|
|
||||||
svr->port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
_ecore_con_server_ecore_con_base_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
_ecore_con_server_ecore_con_base_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
|
||||||
{
|
{
|
||||||
|
@ -1283,7 +1227,7 @@ _ecore_con_server_eo_base_destructor(Eo *obj, Ecore_Con_Server_Data *svr)
|
||||||
Ecore_Con_Client *cl_obj;
|
Ecore_Con_Client *cl_obj;
|
||||||
double t_start, t;
|
double t_start, t;
|
||||||
|
|
||||||
if (svr->event_count) goto end;
|
if (svr->event_count) return;
|
||||||
|
|
||||||
while (svr->infos)
|
while (svr->infos)
|
||||||
{
|
{
|
||||||
|
@ -1309,7 +1253,7 @@ _ecore_con_server_eo_base_destructor(Eo *obj, Ecore_Con_Server_Data *svr)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ecore_con_local_win32_server_del(obj);
|
ecore_con_local_win32_server_del(obj);
|
||||||
#endif
|
#endif
|
||||||
if (svr->event_count) goto end;
|
if (svr->event_count) return;
|
||||||
|
|
||||||
if (svr->buf)
|
if (svr->buf)
|
||||||
eina_binbuf_free(svr->buf);
|
eina_binbuf_free(svr->buf);
|
||||||
|
@ -1352,7 +1296,6 @@ _ecore_con_server_eo_base_destructor(Eo *obj, Ecore_Con_Server_Data *svr)
|
||||||
servers = eina_list_remove(servers, obj);
|
servers = eina_list_remove(servers, obj);
|
||||||
svr->data = NULL;
|
svr->data = NULL;
|
||||||
|
|
||||||
end:
|
|
||||||
eo_do_super(obj, ECORE_CON_SERVER_CLASS, eo_destructor());
|
eo_do_super(obj, ECORE_CON_SERVER_CLASS, eo_destructor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2837,4 +2780,3 @@ _ecore_con_lookup_done(void *data,
|
||||||
#include "ecore_con_base.eo.c"
|
#include "ecore_con_base.eo.c"
|
||||||
#include "ecore_con_client.eo.c"
|
#include "ecore_con_client.eo.c"
|
||||||
#include "ecore_con_server.eo.c"
|
#include "ecore_con_server.eo.c"
|
||||||
#include "ecore_con_connector.eo.c"
|
|
||||||
|
|
|
@ -38,9 +38,6 @@ abstract Ecore.Con.Base (Eo.Base) {
|
||||||
* @brief Return the port that the obj is connected to
|
* @brief Return the port that the obj is connected to
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
set {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
get {
|
get {
|
||||||
legacy: null;
|
legacy: null;
|
||||||
}
|
}
|
||||||
|
@ -198,9 +195,7 @@ type Ecore_Con_Dns_Cb: func void (const(char) *canonname,
|
||||||
* Add events (to all of the ecore con stuff, e.g url).
|
* Add events (to all of the ecore con stuff, e.g url).
|
||||||
* Make server the father of the client - make sure I don't leak references.
|
* Make server the father of the client - make sure I don't leak references.
|
||||||
*
|
*
|
||||||
* Still need to add constructor client, and most likely migrate ecore_con_eet.
|
* Still need to add constructors to server/client, and most likely migrate ecore_con_eet.
|
||||||
*
|
*
|
||||||
* Split server to two classes, listener and connector (or w/e).
|
* Split server to two classes, listener and connector (or w/e).
|
||||||
*
|
|
||||||
* Mark the constructing properties all around.
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
class Ecore.Con.Connector (Ecore.Con.Server) {
|
|
||||||
legacy_prefix: null;
|
|
||||||
eo_prefix: ecore_con_connector_obj;
|
|
||||||
data: null;
|
|
||||||
implements {
|
|
||||||
Eo.Base.finalize;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -198,6 +198,33 @@ struct _Ecore_Con_Server_Data
|
||||||
|
|
||||||
typedef struct _Ecore_Con_Server_Data Ecore_Con_Server_Data;
|
typedef struct _Ecore_Con_Server_Data Ecore_Con_Server_Data;
|
||||||
|
|
||||||
|
struct _Ecore_Con_Url
|
||||||
|
{
|
||||||
|
ECORE_MAGIC;
|
||||||
|
void *curl_easy;
|
||||||
|
struct curl_slist *headers;
|
||||||
|
Eina_List *additional_headers;
|
||||||
|
Eina_List *response_headers;
|
||||||
|
const char *url;
|
||||||
|
long proxy_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
Ecore_Timer *timer;
|
||||||
|
|
||||||
|
Ecore_Con_Url_Time time_condition;
|
||||||
|
double timestamp;
|
||||||
|
void *data;
|
||||||
|
|
||||||
|
void *post_data;
|
||||||
|
|
||||||
|
int received;
|
||||||
|
int write_fd;
|
||||||
|
|
||||||
|
unsigned int event_count;
|
||||||
|
Eina_Bool dead : 1;
|
||||||
|
Eina_Bool multi : 1;
|
||||||
|
};
|
||||||
|
|
||||||
struct _Ecore_Con_Info
|
struct _Ecore_Con_Info
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* FIXME: make abstract. */
|
||||||
class Ecore.Con.Server (Ecore.Con.Base) {
|
class Ecore.Con.Server (Ecore.Con.Base) {
|
||||||
eo_prefix: ecore_con_server_obj;
|
eo_prefix: ecore_con_server_obj;
|
||||||
properties {
|
properties {
|
||||||
|
@ -7,9 +8,6 @@ class Ecore.Con.Server (Ecore.Con.Base) {
|
||||||
*
|
*
|
||||||
* The name returned is the name used to connect on this server.
|
* The name returned is the name used to connect on this server.
|
||||||
*/
|
*/
|
||||||
set {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
get {
|
get {
|
||||||
}
|
}
|
||||||
values {
|
values {
|
||||||
|
@ -54,25 +52,11 @@ class Ecore.Con.Server (Ecore.Con.Base) {
|
||||||
const(Eina_List <const(Ecore.Con.Client) *>) *clients; /*@ The list of clients on this server. */
|
const(Eina_List <const(Ecore.Con.Client) *>) *clients; /*@ The list of clients on this server. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connection_type {
|
|
||||||
get {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
legacy: null;
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
Ecore_Con_Type conn_type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
Eo.Base.constructor;
|
|
||||||
Eo.Base.destructor;
|
Eo.Base.destructor;
|
||||||
Eo.Base.finalize;
|
|
||||||
Ecore.Con.Base.ip.get;
|
Ecore.Con.Base.ip.get;
|
||||||
Ecore.Con.Base.uptime.get;
|
Ecore.Con.Base.uptime.get;
|
||||||
Ecore.Con.Base.port.set;
|
|
||||||
Ecore.Con.Base.port.get;
|
Ecore.Con.Base.port.get;
|
||||||
Ecore.Con.Base.fd.get;
|
Ecore.Con.Base.fd.get;
|
||||||
Ecore.Con.Base.connected.get;
|
Ecore.Con.Base.connected.get;
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
#include "Ecore_Con.h"
|
#include "Ecore_Con.h"
|
||||||
#include "ecore_con_private.h"
|
#include "ecore_con_private.h"
|
||||||
|
|
||||||
#define MY_CLASS ECORE_CON_URL_CLASS
|
|
||||||
|
|
||||||
// all the types, defines, enums etc. from curl that we actuall USE.
|
// all the types, defines, enums etc. from curl that we actuall USE.
|
||||||
// we have to add to this if we use more things from curl not already
|
// we have to add to this if we use more things from curl not already
|
||||||
// defined here. see culr headers to get them from
|
// defined here. see culr headers to get them from
|
||||||
|
@ -224,34 +222,6 @@ struct _Ecore_Con_Curl
|
||||||
curl_version_info_data *(*curl_version_info)(CURLversion);
|
curl_version_info_data *(*curl_version_info)(CURLversion);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_Con_Url_Data
|
|
||||||
{
|
|
||||||
void *curl_easy;
|
|
||||||
struct curl_slist *headers;
|
|
||||||
Eina_List *additional_headers;
|
|
||||||
Eina_List *response_headers;
|
|
||||||
const char *url;
|
|
||||||
long proxy_type;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
Ecore_Timer *timer;
|
|
||||||
|
|
||||||
Ecore_Con_Url_Time time_condition;
|
|
||||||
double timestamp;
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
void *post_data;
|
|
||||||
|
|
||||||
int received;
|
|
||||||
int write_fd;
|
|
||||||
|
|
||||||
unsigned int event_count;
|
|
||||||
Eina_Bool dead : 1;
|
|
||||||
Eina_Bool multi : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _Ecore_Con_Url_Data Ecore_Con_Url_Data;
|
|
||||||
|
|
||||||
#define CURL_MIN_TIMEOUT 100
|
#define CURL_MIN_TIMEOUT 100
|
||||||
|
|
||||||
int ECORE_CON_EVENT_URL_DATA = 0;
|
int ECORE_CON_EVENT_URL_DATA = 0;
|
||||||
|
@ -432,40 +402,29 @@ extern Ecore_Con_Socks *_ecore_con_proxy_global;
|
||||||
EAPI Ecore_Con_Url *
|
EAPI Ecore_Con_Url *
|
||||||
ecore_con_url_new(const char *url)
|
ecore_con_url_new(const char *url)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url *url_obj;
|
Ecore_Con_Url *url_con;
|
||||||
url_obj = eo_add(ECORE_CON_URL_CLASS, NULL,
|
CURLcode ret;
|
||||||
ecore_con_url_obj_url_set(url));
|
|
||||||
|
|
||||||
return url_obj;
|
if (!_init_count) return NULL;
|
||||||
}
|
if (!_c_init()) return NULL;
|
||||||
|
|
||||||
EOLIAN static void
|
url_con = calloc(1, sizeof(Ecore_Con_Url));
|
||||||
_ecore_con_url_eo_base_constructor(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *url_con EINA_UNUSED)
|
if (!url_con) return NULL;
|
||||||
{
|
|
||||||
eo_do_super(url_obj, MY_CLASS, eo_constructor());
|
|
||||||
|
|
||||||
if (!_init_count) eo_error_set(url_obj);
|
url_con->write_fd = -1;
|
||||||
if (!_c_init()) eo_error_set(url_obj);
|
|
||||||
|
|
||||||
url_con->curl_easy = _c->curl_easy_init();
|
url_con->curl_easy = _c->curl_easy_init();
|
||||||
if (!url_con->curl_easy)
|
if (!url_con->curl_easy)
|
||||||
{
|
{
|
||||||
eo_error_set(url_obj);
|
free(url_con);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_CON_URL);
|
||||||
|
|
||||||
EOLIAN static Eo *
|
if (!ecore_con_url_url_set(url_con, url))
|
||||||
_ecore_con_url_eo_base_finalize(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *url_con)
|
|
||||||
{
|
|
||||||
CURLcode ret;
|
|
||||||
|
|
||||||
url_con->write_fd = -1;
|
|
||||||
|
|
||||||
if (!url_con->url)
|
|
||||||
{
|
{
|
||||||
ecore_con_url_free(url_obj);
|
ecore_con_url_free(url_con);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,8 +462,8 @@ _ecore_con_url_eo_base_finalize(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *url_
|
||||||
_ecore_con_proxy_global->port);
|
_ecore_con_proxy_global->port);
|
||||||
else snprintf(proxy, sizeof(proxy), "%s", host);
|
else snprintf(proxy, sizeof(proxy), "%s", host);
|
||||||
|
|
||||||
ecore_con_url_proxy_set(url_obj, proxy);
|
ecore_con_url_proxy_set(url_con, proxy);
|
||||||
ecore_con_url_proxy_username_set(url_obj,
|
ecore_con_url_proxy_username_set(url_con,
|
||||||
_ecore_con_proxy_global->username);
|
_ecore_con_proxy_global->username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,45 +473,44 @@ _ecore_con_url_eo_base_finalize(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *url_
|
||||||
{
|
{
|
||||||
ERR("Could not set CURLOPT_ENCODING to \"gzip,deflate\": %s",
|
ERR("Could not set CURLOPT_ENCODING to \"gzip,deflate\": %s",
|
||||||
_c->curl_easy_strerror(ret));
|
_c->curl_easy_strerror(ret));
|
||||||
ecore_con_url_free(url_obj);
|
ecore_con_url_free(url_con);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION,
|
||||||
_ecore_con_url_data_cb);
|
_ecore_con_url_data_cb);
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEDATA, url_obj);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEDATA, url_con);
|
||||||
|
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION,
|
||||||
_ecore_con_url_progress_cb);
|
_ecore_con_url_progress_cb);
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSDATA, url_obj);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSDATA, url_con);
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE);
|
||||||
|
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION,
|
||||||
_ecore_con_url_header_cb);
|
_ecore_con_url_header_cb);
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_obj);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_con);
|
||||||
/*
|
/*
|
||||||
* FIXME: Check that these timeouts are sensible defaults
|
* FIXME: Check that these timeouts are sensible defaults
|
||||||
* FIXME: Provide a means to change these timeouts
|
* FIXME: Provide a means to change these timeouts
|
||||||
*/
|
*/
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_CONNECTTIMEOUT, 30);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_FOLLOWLOCATION, 1);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
return url_obj;
|
return url_con;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_Con_Url *
|
EAPI Ecore_Con_Url *
|
||||||
ecore_con_url_custom_new(const char *url,
|
ecore_con_url_custom_new(const char *url,
|
||||||
const char *custom_request)
|
const char *custom_request)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url *url_obj;
|
Ecore_Con_Url *url_con;
|
||||||
CURLcode ret;
|
CURLcode ret;
|
||||||
|
|
||||||
if (!_init_count) return NULL;
|
if (!_init_count) return NULL;
|
||||||
if (!_c_init()) return NULL;
|
if (!_c_init()) return NULL;
|
||||||
if (!url) return NULL;
|
if (!url) return NULL;
|
||||||
if (!custom_request) return NULL;
|
if (!custom_request) return NULL;
|
||||||
url_obj = ecore_con_url_new(url);
|
url_con = ecore_con_url_new(url);
|
||||||
if (!url_obj) return NULL;
|
if (!url_con) return NULL;
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
|
|
||||||
ret = _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_CUSTOMREQUEST,
|
ret = _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_CUSTOMREQUEST,
|
||||||
custom_request);
|
custom_request);
|
||||||
|
@ -560,27 +518,23 @@ ecore_con_url_custom_new(const char *url,
|
||||||
{
|
{
|
||||||
ERR("Could not set a custom request string: %s",
|
ERR("Could not set a custom request string: %s",
|
||||||
_c->curl_easy_strerror(ret));
|
_c->curl_easy_strerror(ret));
|
||||||
ecore_con_url_free(url_obj);
|
ecore_con_url_free(url_con);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return url_obj;
|
return url_con;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_free(Ecore_Con_Url *url_obj)
|
ecore_con_url_free(Ecore_Con_Url *url_con)
|
||||||
{
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
|
|
||||||
eo_del(url_obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_ecore_con_url_eo_base_destructor(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *url_con)
|
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->curl_easy)
|
if (url_con->curl_easy)
|
||||||
{
|
{
|
||||||
// FIXME : How can we delete curl_easy's fds ??
|
// FIXME : How can we delete curl_easy's fds ??
|
||||||
|
@ -593,8 +547,8 @@ _ecore_con_url_eo_base_destructor(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *ur
|
||||||
|
|
||||||
if (url_con->multi)
|
if (url_con->multi)
|
||||||
{
|
{
|
||||||
_ecore_con_url_multi_remove(url_obj);
|
_ecore_con_url_multi_remove(url_con);
|
||||||
_url_con_list = eina_list_remove(_url_con_list, url_obj);
|
_url_con_list = eina_list_remove(_url_con_list, url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
_c->curl_easy_cleanup(url_con->curl_easy);
|
_c->curl_easy_cleanup(url_con->curl_easy);
|
||||||
|
@ -605,6 +559,7 @@ _ecore_con_url_eo_base_destructor(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *ur
|
||||||
url_con->timer = NULL;
|
url_con->timer = NULL;
|
||||||
url_con->dead = EINA_TRUE;
|
url_con->dead = EINA_TRUE;
|
||||||
if (url_con->event_count) return;
|
if (url_con->event_count) return;
|
||||||
|
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
|
||||||
|
|
||||||
_c->curl_slist_free_all(url_con->headers);
|
_c->curl_slist_free_all(url_con->headers);
|
||||||
EINA_LIST_FREE(url_con->additional_headers, s)
|
EINA_LIST_FREE(url_con->additional_headers, s)
|
||||||
|
@ -613,29 +568,42 @@ _ecore_con_url_eo_base_destructor(Ecore_Con_Url *url_obj, Ecore_Con_Url_Data *ur
|
||||||
free(s);
|
free(s);
|
||||||
eina_stringshare_del(url_con->url);
|
eina_stringshare_del(url_con->url);
|
||||||
if (url_con->post_data) free(url_con->post_data);
|
if (url_con->post_data) free(url_con->post_data);
|
||||||
|
free(url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static const char *
|
EAPI const char *
|
||||||
_ecore_con_url_url_get(Ecore_Con_Url *url_obj EINA_UNUSED, Ecore_Con_Url_Data *url_con)
|
ecore_con_url_url_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return url_con->url;
|
return url_con->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_con_url_status_code_get(Ecore_Con_Url *url_obj)
|
ecore_con_url_status_code_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return 0;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (url_con->status) return url_con->status;
|
if (url_con->status) return url_con->status;
|
||||||
_ecore_con_url_status_get(url_obj);
|
_ecore_con_url_status_get(url_con);
|
||||||
return url_con->status;
|
return url_con->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EAPI Eina_Bool
|
||||||
_ecore_con_url_url_set(Ecore_Con_Url *url_obj EINA_UNUSED, Ecore_Con_Url_Data *url_con, const char *url)
|
ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
|
||||||
{
|
{
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
eina_stringshare_replace(&url_con->url, url);
|
eina_stringshare_replace(&url_con->url, url);
|
||||||
if (url_con->url)
|
if (url_con->url)
|
||||||
|
@ -647,22 +615,27 @@ _ecore_con_url_url_set(Ecore_Con_Url *url_obj EINA_UNUSED, Ecore_Con_Url_Data *u
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_data_set(Ecore_Con_Url *url_obj, void *data)
|
ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
url_con->data = data;
|
url_con->data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_additional_header_add(Ecore_Con_Url *url_obj, const char *key, const char *value)
|
ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
tmp = malloc(strlen(key) + strlen(value) + 3);
|
tmp = malloc(strlen(key) + strlen(value) + 3);
|
||||||
if (!tmp) return;
|
if (!tmp) return;
|
||||||
|
@ -672,75 +645,89 @@ ecore_con_url_additional_header_add(Ecore_Con_Url *url_obj, const char *key, con
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_obj)
|
ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
EINA_LIST_FREE(url_con->additional_headers, s)
|
EINA_LIST_FREE(url_con->additional_headers, s)
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
ecore_con_url_data_get(Ecore_Con_Url *url_obj)
|
ecore_con_url_data_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return NULL;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return url_con->data;
|
return url_con->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_time(Ecore_Con_Url *url_obj, Ecore_Con_Url_Time condition, double timestamp)
|
ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, double timestamp)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
url_con->time_condition = condition;
|
url_con->time_condition = condition;
|
||||||
url_con->timestamp = timestamp;
|
url_con->timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_fd_set(Ecore_Con_Url *url_obj, int fd)
|
ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
url_con->write_fd = fd;
|
url_con->write_fd = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_con_url_received_bytes_get(Ecore_Con_Url *url_obj)
|
ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return -1;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return url_con->received;
|
return url_con->received;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eina_List *
|
EAPI const Eina_List *
|
||||||
ecore_con_url_response_headers_get(Ecore_Con_Url *url_obj)
|
ecore_con_url_response_headers_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return NULL;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return url_con->response_headers;
|
return url_con->response_headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_httpauth_set(Ecore_Con_Url *url_obj, const char *username, const char *password, Eina_Bool safe)
|
ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
CURLcode ret;
|
CURLcode ret;
|
||||||
curl_version_info_data *vers = NULL;
|
curl_version_info_data *vers = NULL;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
vers = _c->curl_version_info(CURLVERSION_NOW);
|
vers = _c->curl_version_info(CURLVERSION_NOW);
|
||||||
if (vers->version_num >= 0x071301)
|
if (vers->version_num >= 0x071301)
|
||||||
|
@ -782,16 +769,18 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_obj, const char *username, const c
|
||||||
#define MODE_POST 2
|
#define MODE_POST 2
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_ecore_con_url_send(Ecore_Con_Url *url_obj, int mode, const void *data, long length, const char *content_type)
|
_ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long length, const char *content_type)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
const char *s;
|
const char *s;
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!url_con->url) return EINA_FALSE;
|
if (!url_con->url) return EINA_FALSE;
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
|
@ -864,7 +853,7 @@ _ecore_con_url_send(Ecore_Con_Url *url_obj, int mode, const void *data, long len
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPHEADER,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPHEADER,
|
||||||
url_con->headers);
|
url_con->headers);
|
||||||
url_con->received = 0;
|
url_con->received = 0;
|
||||||
return _ecore_con_url_perform(url_obj);
|
return _ecore_con_url_perform(url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
@ -880,11 +869,8 @@ ecore_con_url_post(Ecore_Con_Url *url_con, const void *data, long length, const
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_ftp_upload(Ecore_Con_Url *url_obj, const char *filename, const char *user, const char *pass, const char *upload_dir)
|
ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, MY_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
char url[4096];
|
char url[4096];
|
||||||
char userpwd[4096];
|
char userpwd[4096];
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
@ -892,6 +878,11 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_obj, const char *filename, const cha
|
||||||
CURLcode ret;
|
CURLcode ret;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
if (!url_con->url) return EINA_FALSE;
|
if (!url_con->url) return EINA_FALSE;
|
||||||
|
@ -918,7 +909,7 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_obj, const char *filename, const cha
|
||||||
snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
|
snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
|
||||||
basename(tmp));
|
basename(tmp));
|
||||||
|
|
||||||
if (!ecore_con_url_url_set(url_obj, url))
|
if (!ecore_con_url_url_set(url_con, url))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
|
||||||
(off_t)file_info.st_size);
|
(off_t)file_info.st_size);
|
||||||
|
@ -932,73 +923,85 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_obj, const char *filename, const cha
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
|
||||||
return _ecore_con_url_perform(url_obj);
|
return _ecore_con_url_perform(url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_init(Ecore_Con_Url *url_obj)
|
ecore_con_url_cookies_init(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, "");
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_obj, Eina_Bool ignore)
|
ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, Eina_Bool ignore)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_clear(Ecore_Con_Url *url_obj)
|
ecore_con_url_cookies_clear(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL");
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL");
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_obj)
|
ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS");
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS");
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_file_add(Ecore_Con_Url *url_obj, const char *const file_name)
|
ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char *const file_name)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_obj, const char *const cookiejar_file)
|
ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char *const cookiejar_file)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
CURLcode ret;
|
CURLcode ret;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
ret = _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR,
|
ret = _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR,
|
||||||
cookiejar_file);
|
cookiejar_file);
|
||||||
|
@ -1012,36 +1015,42 @@ ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_obj, const char *const coo
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_obj)
|
ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH");
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH");
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_verbose_set(Ecore_Con_Url *url_obj, Eina_Bool verbose)
|
ecore_con_url_verbose_set(Ecore_Con_Url *url_con, Eina_Bool verbose)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!url_con->url) return;
|
if (!url_con->url) return;
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose);
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_obj, Eina_Bool use_epsv)
|
ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, Eina_Bool use_epsv)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!url_con->url) return;
|
if (!url_con->url) return;
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV,
|
||||||
|
@ -1061,12 +1070,14 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_obj, Eina_Bool use_epsv)
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_obj, Eina_Bool verify)
|
ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, Eina_Bool verify)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return;
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!url_con->url) return;
|
if (!url_con->url) return;
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER,
|
_c->curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER,
|
||||||
|
@ -1092,14 +1103,16 @@ ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_obj, Eina_Bool verify)
|
||||||
* are equal to cURL error codes.
|
* are equal to cURL error codes.
|
||||||
*/
|
*/
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_obj, const char *ca_path)
|
ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return -1;
|
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (!_c) return -1;
|
if (!_c) return -1;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (!url_con->url) return -1;
|
if (!url_con->url) return -1;
|
||||||
if (url_con->dead) return -1;
|
if (url_con->dead) return -1;
|
||||||
if (ca_path == NULL)
|
if (ca_path == NULL)
|
||||||
|
@ -1116,14 +1129,16 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_obj, const char *ca_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_http_version_set(Ecore_Con_Url *url_obj, Ecore_Con_Url_Http_Version version)
|
ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
switch (version)
|
switch (version)
|
||||||
{
|
{
|
||||||
|
@ -1151,15 +1166,17 @@ ecore_con_url_http_version_set(Ecore_Con_Url *url_obj, Ecore_Con_Url_Http_Versio
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_proxy_set(Ecore_Con_Url *url_obj, const char *proxy)
|
ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
int res = -1;
|
int res = -1;
|
||||||
curl_version_info_data *vers = NULL;
|
curl_version_info_data *vers = NULL;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (!url_con->url) return EINA_FALSE;
|
if (!url_con->url) return EINA_FALSE;
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
if (!proxy)
|
if (!proxy)
|
||||||
|
@ -1203,27 +1220,31 @@ ecore_con_url_proxy_set(Ecore_Con_Url *url_obj, const char *proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_timeout_set(Ecore_Con_Url *url_obj, double timeout)
|
ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
{
|
||||||
return;
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (url_con->dead) return;
|
if (url_con->dead) return;
|
||||||
if (!url_con->url || timeout < 0) return;
|
if (!url_con->url || timeout < 0) return;
|
||||||
if (url_con->timer) ecore_timer_del(url_con->timer);
|
if (url_con->timer) ecore_timer_del(url_con->timer);
|
||||||
url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb,
|
url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb,
|
||||||
url_obj);
|
url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_proxy_username_set(Ecore_Con_Url *url_obj, const char *username)
|
ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
if (!url_con->url) return EINA_FALSE;
|
if (!url_con->url) return EINA_FALSE;
|
||||||
if ((!username) || (!username[0])) return EINA_FALSE;
|
if ((!username) || (!username[0])) return EINA_FALSE;
|
||||||
|
@ -1244,14 +1265,16 @@ ecore_con_url_proxy_username_set(Ecore_Con_Url *url_obj, const char *username)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_con_url_proxy_password_set(Ecore_Con_Url *url_obj, const char *password)
|
ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return EINA_FALSE;
|
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
if (!url_con->url) return EINA_FALSE;
|
if (!url_con->url) return EINA_FALSE;
|
||||||
if (url_con->dead) return EINA_FALSE;
|
if (url_con->dead) return EINA_FALSE;
|
||||||
if (!password) return EINA_FALSE;
|
if (!password) return EINA_FALSE;
|
||||||
|
@ -1274,9 +1297,8 @@ ecore_con_url_proxy_password_set(Ecore_Con_Url *url_obj, const char *password)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_con_url_status_get(Ecore_Con_Url *url_obj)
|
_ecore_con_url_status_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
long status = 0;
|
long status = 0;
|
||||||
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
@ -1289,9 +1311,8 @@ _ecore_con_url_status_get(Ecore_Con_Url *url_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_con_url_event_url_complete(Ecore_Con_Url *url_obj, CURLMsg *curlmsg)
|
_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
Ecore_Con_Event_Url_Complete *e;
|
Ecore_Con_Event_Url_Complete *e;
|
||||||
int status = url_con->status;
|
int status = url_con->status;
|
||||||
|
|
||||||
|
@ -1312,7 +1333,7 @@ _ecore_con_url_event_url_complete(Ecore_Con_Url *url_obj, CURLMsg *curlmsg)
|
||||||
{
|
{
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
_ecore_con_url_status_get(url_obj);
|
_ecore_con_url_status_get(url_con);
|
||||||
status = url_con->status;
|
status = url_con->status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1322,16 +1343,15 @@ _ecore_con_url_event_url_complete(Ecore_Con_Url *url_obj, CURLMsg *curlmsg)
|
||||||
curlmsg->data.result, _c->curl_easy_strerror(curlmsg->data.result));
|
curlmsg->data.result, _c->curl_easy_strerror(curlmsg->data.result));
|
||||||
}
|
}
|
||||||
e->status = status;
|
e->status = status;
|
||||||
e->url_con = url_obj;
|
e->url_con = url_con;
|
||||||
url_con->event_count++;
|
url_con->event_count++;
|
||||||
ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e,
|
ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e,
|
||||||
(Ecore_End_Cb)_ecore_con_event_url_free, url_obj);
|
(Ecore_End_Cb)_ecore_con_event_url_free, url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_con_url_multi_remove(Ecore_Con_Url *url_obj)
|
_ecore_con_url_multi_remove(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
CURLMcode ret;
|
CURLMcode ret;
|
||||||
|
|
||||||
if (!_c) return;
|
if (!_c) return;
|
||||||
|
@ -1343,16 +1363,15 @@ _ecore_con_url_multi_remove(Ecore_Con_Url *url_obj)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_ecore_con_url_timeout_cb(void *data)
|
_ecore_con_url_timeout_cb(void *data)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url *url_obj = data;
|
Ecore_Con_Url *url_con = data;
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
CURLMsg timeout_msg;
|
CURLMsg timeout_msg;
|
||||||
|
|
||||||
if (!_c) return ECORE_CALLBACK_CANCEL;
|
if (!_c) return ECORE_CALLBACK_CANCEL;
|
||||||
if (!url_obj) return ECORE_CALLBACK_CANCEL;
|
if (!url_con) return ECORE_CALLBACK_CANCEL;
|
||||||
if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL;
|
if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL;
|
||||||
|
|
||||||
_ecore_con_url_multi_remove(url_obj);
|
_ecore_con_url_multi_remove(url_con);
|
||||||
_url_con_list = eina_list_remove(_url_con_list, url_obj);
|
_url_con_list = eina_list_remove(_url_con_list, url_con);
|
||||||
|
|
||||||
_c->curl_slist_free_all(url_con->headers);
|
_c->curl_slist_free_all(url_con->headers);
|
||||||
url_con->headers = NULL;
|
url_con->headers = NULL;
|
||||||
|
@ -1363,20 +1382,24 @@ _ecore_con_url_timeout_cb(void *data)
|
||||||
timeout_msg.easy_handle = NULL;
|
timeout_msg.easy_handle = NULL;
|
||||||
timeout_msg.data.result = CURLE_OPERATION_TIMEDOUT;
|
timeout_msg.data.result = CURLE_OPERATION_TIMEDOUT;
|
||||||
|
|
||||||
_ecore_con_url_event_url_complete(url_obj, &timeout_msg);
|
_ecore_con_url_event_url_complete(url_con, &timeout_msg);
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
_ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp)
|
_ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url *url_obj = (Ecore_Con_Url *)userp;
|
Ecore_Con_Url *url_con;
|
||||||
Ecore_Con_Event_Url_Data *e;
|
Ecore_Con_Event_Url_Data *e;
|
||||||
size_t real_size = size * nitems;
|
size_t real_size = size * nitems;
|
||||||
|
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
url_con = (Ecore_Con_Url *)userp;
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
if (!url_con) return -1;
|
||||||
return -1;
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
url_con->received += real_size;
|
url_con->received += real_size;
|
||||||
INF("reading from %s", url_con->url);
|
INF("reading from %s", url_con->url);
|
||||||
|
@ -1387,12 +1410,12 @@ _ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp)
|
||||||
(real_size - 1));
|
(real_size - 1));
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
e->url_con = url_obj;
|
e->url_con = url_con;
|
||||||
e->size = real_size;
|
e->size = real_size;
|
||||||
memcpy(e->data, buffer, real_size);
|
memcpy(e->data, buffer, real_size);
|
||||||
url_con->event_count++;
|
url_con->event_count++;
|
||||||
ecore_event_add(ECORE_CON_EVENT_URL_DATA, e,
|
ecore_event_add(ECORE_CON_EVENT_URL_DATA, e,
|
||||||
(Ecore_End_Cb)_ecore_con_event_url_free, url_obj);
|
(Ecore_End_Cb)_ecore_con_event_url_free, url_con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1424,10 +1447,7 @@ static size_t
|
||||||
_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream)
|
_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream)
|
||||||
{
|
{
|
||||||
size_t real_size = size * nitems;
|
size_t real_size = size * nitems;
|
||||||
Ecore_Con_Url *url_obj = stream;
|
Ecore_Con_Url *url_con = stream;
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (!eo_isa(url_obj, ECORE_CON_URL_CLASS))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char *header = malloc(sizeof(char) * (real_size + 1));
|
char *header = malloc(sizeof(char) * (real_size + 1));
|
||||||
if (!header) return real_size;
|
if (!header) return real_size;
|
||||||
|
@ -1442,21 +1462,20 @@ static int
|
||||||
_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Url_Progress *e;
|
Ecore_Con_Event_Url_Progress *e;
|
||||||
Ecore_Con_Url *url_obj = clientp;
|
Ecore_Con_Url *url_con;
|
||||||
|
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
|
|
||||||
|
url_con = clientp;
|
||||||
e = malloc(sizeof(Ecore_Con_Event_Url_Progress));
|
e = malloc(sizeof(Ecore_Con_Event_Url_Progress));
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
e->url_con = url_obj;
|
e->url_con = url_con;
|
||||||
e->down.total = dltotal;
|
e->down.total = dltotal;
|
||||||
e->down.now = dlnow;
|
e->down.now = dlnow;
|
||||||
e->up.total = ultotal;
|
e->up.total = ultotal;
|
||||||
e->up.now = ulnow;
|
e->up.now = ulnow;
|
||||||
url_con->event_count++;
|
url_con->event_count++;
|
||||||
ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e,
|
ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e,
|
||||||
(Ecore_End_Cb)_ecore_con_event_url_free, url_obj);
|
(Ecore_End_Cb)_ecore_con_event_url_free, url_con);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1490,16 +1509,15 @@ _ecore_con_url_info_read(void)
|
||||||
while ((curlmsg = _c->curl_multi_info_read(_c->_curlm, &n_remaining)))
|
while ((curlmsg = _c->curl_multi_info_read(_c->_curlm, &n_remaining)))
|
||||||
{
|
{
|
||||||
Eina_List *l, *ll;
|
Eina_List *l, *ll;
|
||||||
Ecore_Con_Url *url_obj = NULL;
|
Ecore_Con_Url *url_con = NULL;
|
||||||
|
|
||||||
DBG("Curl message: %d", curlmsg->msg);
|
DBG("Curl message: %d", curlmsg->msg);
|
||||||
if (curlmsg->msg == CURLMSG_DONE)
|
if (curlmsg->msg == CURLMSG_DONE)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_obj)
|
EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
if (curlmsg->easy_handle == url_con->curl_easy)
|
if (curlmsg->easy_handle == url_con->curl_easy)
|
||||||
_ecore_con_url_event_url_complete(url_obj, curlmsg);
|
_ecore_con_url_event_url_complete(url_con, curlmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1620,9 +1638,8 @@ _ecore_con_url_timer(void *data EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_ecore_con_url_perform(Ecore_Con_Url *url_obj)
|
_ecore_con_url_perform(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
CURLMcode ret;
|
CURLMcode ret;
|
||||||
|
|
||||||
if (!_c) return EINA_FALSE;
|
if (!_c) return EINA_FALSE;
|
||||||
|
@ -1634,19 +1651,16 @@ _ecore_con_url_perform(Ecore_Con_Url *url_obj)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
url_con->multi = EINA_TRUE;
|
url_con->multi = EINA_TRUE;
|
||||||
_url_con_list = eina_list_append(_url_con_list, url_obj);
|
_url_con_list = eina_list_append(_url_con_list, url_con);
|
||||||
ecore_timer_thaw(_curl_timer);
|
ecore_timer_thaw(_curl_timer);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_con_event_url_free(Ecore_Con_Url *url_obj, void *ev)
|
_ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev)
|
||||||
{
|
{
|
||||||
Ecore_Con_Url_Data *url_con = eo_data_scope_get(url_obj, MY_CLASS);
|
|
||||||
|
|
||||||
free(ev);
|
free(ev);
|
||||||
url_con->event_count--;
|
url_con->event_count--;
|
||||||
if (url_con->dead && (!url_con->event_count)) ecore_con_url_free(url_obj);
|
if (url_con->dead && (!url_con->event_count)) ecore_con_url_free(url_con);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "ecore_con_url.eo.c"
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
class Ecore.Con.Url (Eo.Base) {
|
|
||||||
eo_prefix: ecore_con_url_obj;
|
|
||||||
properties {
|
|
||||||
url {
|
|
||||||
/**
|
|
||||||
* Controls the URL to send the request to.
|
|
||||||
*/
|
|
||||||
set {
|
|
||||||
return: bool (false); /* true on success, false on error. */
|
|
||||||
}
|
|
||||||
get {
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
const(char) *url; /*@ The URL */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
implements {
|
|
||||||
Eo.Base.constructor;
|
|
||||||
Eo.Base.destructor;
|
|
||||||
Eo.Base.finalize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Actually migrate all of the functions. */
|
|
Loading…
Reference in New Issue