Ecore URL Connection Functions

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Enumerations | Functions | Variables
Ecore URL Connection Functions
Ecore » Ecore_Con - Connection functions

Utility functions that set up, use and shut down the Ecore URL Connection library. More...

## Data Structures
struct | _Ecore_Con_Event_Url_Data
| Used as the `data` param for the ECORE_CON_EVENT_URL_DATA event. More...
struct | _Ecore_Con_Event_Url_Complete
| Used as the `data` param for the ECORE_CON_EVENT_URL_COMPLETE event. More...
struct | _Ecore_Con_Event_Url_Progress
| Used as the `data` param for the ECORE_CON_EVENT_URL_PROGRESS event. More...

## Typedefs
typedef enum _Ecore_Con_Url_Time | Ecore_Con_Url_Time
typedef enum _Ecore_Con_Url_Http_Version | Ecore_Con_Url_Http_Version
typedef struct _Ecore_Con_Event_Url_Data | Ecore_Con_Event_Url_Data
| Used as the `data` param for the corresponding event.
typedef struct _Ecore_Con_Event_Url_Complete | Ecore_Con_Event_Url_Complete
| Used as the `data` param for the corresponding event.
typedef struct _Ecore_Con_Event_Url_Progress | Ecore_Con_Event_Url_Progress
| Used as the `data` param for the corresponding event.

## Enumerations
enum | _Ecore_Con_Url_Time { ECORE_CON_URL_TIME_NONE = 0, ECORE_CON_URL_TIME_IFMODSINCE, ECORE_CON_URL_TIME_IFUNMODSINCE }
| The type of condition to use when making an HTTP request dependent on time, so that headers such as "If-Modified-Since" are used. More...
enum | _Ecore_Con_Url_Http_Version { ECORE_CON_URL_HTTP_VERSION_1_0, ECORE_CON_URL_HTTP_VERSION_1_1 }
| The http version to use. More...

## Functions
EAPI Eina_Bool | ecore_con_url_http_version_set (Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version)
| Change the HTTP version used for the request. More...
EAPI int | ecore_con_url_init (void)
| Initialise the Ecore_Con_Url library. More...
EAPI int | ecore_con_url_shutdown (void)
| Shut down the Ecore_Con_Url library. More...
EAPI void | ecore_con_url_pipeline_set (Eina_Bool enable)
| Enable or disable HTTP 1.1 pipelining. More...
EAPI Eina_Bool | ecore_con_url_pipeline_get (void)
| Is HTTP 1.1 pipelining enable ? More...
EAPI Ecore_Con_Url * | ecore_con_url_new (const char *url)
| Create and initialize a new Ecore_Con_Url connection object. More...
EAPI Ecore_Con_Url * | ecore_con_url_custom_new (const char *url, const char *custom_request)
| Create a custom connection object. More...
EAPI void | ecore_con_url_free (Ecore_Con_Url *url_con)
| Destroy a Ecore_Con_Url connection object. More...
EAPI void | ecore_con_url_data_set (Ecore_Con_Url *url_con, void *data)
| Associate data with a connection object. More...
EAPI void * | ecore_con_url_data_get (Ecore_Con_Url *url_con)
| Retrieve data associated with a Ecore_Con_Url connection object. More...
EAPI void | ecore_con_url_additional_header_add (Ecore_Con_Url *url_con, const char *key, const char *value)
| Add an additional header to the request connection object. More...
EAPI void | ecore_con_url_additional_headers_clear (Ecore_Con_Url *url_con)
| Clean additional headers. More...
EAPI const Eina_List * | ecore_con_url_response_headers_get (Ecore_Con_Url *url_con)
| Retrieve headers from last request sent. More...
EAPI void | ecore_con_url_fd_set (Ecore_Con_Url *url_con, int fd)
| Set up a file for receiving response data. More...
EAPI int | ecore_con_url_received_bytes_get (Ecore_Con_Url *url_con)
| Retrieve the number of bytes received. More...
EAPI Eina_Bool | ecore_con_url_httpauth_set (Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
| Set url_con to use http auth, with given username and password, "safely" or not. More...
EAPI Eina_Bool | ecore_con_url_get (Ecore_Con_Url *url_con)
| Send a get request. More...
EAPI Eina_Bool | ecore_con_url_head (Ecore_Con_Url *url_con)
| Send a HEAD request. More...
EAPI Eina_Bool | ecore_con_url_post (Ecore_Con_Url *url_con, const void *data, long length, const char *content_type)
| Send a post request. More...
EAPI void | ecore_con_url_time (Ecore_Con_Url *url_con, Ecore_Con_Url_Time time_condition, double timestamp)
| Set whether HTTP requests should be conditional, dependent on modification time. More...
EAPI Eina_Bool | ecore_con_url_ftp_upload (Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
| Upload a file to an ftp site. More...
EAPI void | ecore_con_url_verbose_set (Ecore_Con_Url *url_con, Eina_Bool verbose)
| Toggle libcurl's verbose output. More...
EAPI void | ecore_con_url_ftp_use_epsv_set (Ecore_Con_Url *url_con, Eina_Bool use_epsv)
| Enable or disable EPSV extension. More...
EAPI void | ecore_con_url_cookies_init (Ecore_Con_Url *url_con)
| Enable the cookie engine for subsequent HTTP requests. More...
EAPI void | ecore_con_url_cookies_ignore_old_session_set (Ecore_Con_Url *url_con, Eina_Bool ignore)
| Control whether session cookies from previous sessions shall be loaded. More...
EAPI void | ecore_con_url_cookies_clear (Ecore_Con_Url *url_con)
| Clear currently loaded cookies. More...
EAPI void | ecore_con_url_cookies_session_clear (Ecore_Con_Url *url_con)
| Clear currently loaded session cookies. More...
EAPI void | ecore_con_url_cookies_file_add (Ecore_Con_Url *url_con, const char *const file_name)
| Add a file to the list of files from which to load cookies. More...
EAPI Eina_Bool | ecore_con_url_cookies_jar_file_set (Ecore_Con_Url *url_con, const char *const cookiejar_file)
| Set the name of the file to which all current cookies will be written when either cookies are flushed or Ecore_Con is shut down. More...
EAPI void | ecore_con_url_cookies_jar_write (Ecore_Con_Url *url_con)
| Write all current cookies to the cookie jar immediately. More...
EAPI void | ecore_con_url_ssl_verify_peer_set (Ecore_Con_Url *url_obj, Eina_Bool verify)
| Toggle libcurl's verify peer's certificate option. More...
EAPI int | ecore_con_url_ssl_ca_set (Ecore_Con_Url *url_obj, const char *ca_path)
| Set a custom CA to trust for SSL/TLS connections. More...
EAPI Eina_Bool | ecore_con_url_proxy_set (Ecore_Con_Url *url_con, const char *proxy)
| Set HTTP proxy to use. More...
EAPI Eina_Bool | ecore_con_url_proxy_username_set (Ecore_Con_Url *url_con, const char *username)
| Set zero terminated username to use for proxy. More...
EAPI Eina_Bool | ecore_con_url_proxy_password_set (Ecore_Con_Url *url_con, const char *password)
| Set zero terminated password to use for proxy. More...
EAPI void | ecore_con_url_timeout_set (Ecore_Con_Url *url_con, double timeout)
| Set timeout in seconds. More...
EAPI int | ecore_con_url_status_code_get (Ecore_Con_Url *url_con)
| Get the returned HTTP STATUS code. More...
static Eina_Bool | _efl_network_url_event_complete_cb (void *data, Eo *child, const Eo_Event_Description *desc, void *einfo)
static Eina_Bool | _efl_network_url_event_data_cb (void *data, Eo *child, const Eo_Event_Description *desc, void *einfo)
static Eina_Bool | _efl_network_url_event_progress_cb (void *data, Eo *child, const Eo_Event_Description *desc, void *einfo)
| EO_CALLBACKS_ARRAY_DEFINE (efl_network_url_event_table_callbacks,{EFL_NETWORK_URL_EVENT_DATA, _efl_network_url_event_data_cb},{EFL_NETWORK_URL_EVENT_PROGRESS, _efl_network_url_event_progress_cb},{EFL_NETWORK_URL_EVENT_COMPLETE, _efl_network_url_event_complete_cb})
static EOLIAN Eo * | _efl_network_url_eo_base_constructor (Efl_Network_Url *url_obj, Efl_Network_Url_Data *url_con)
static EOLIAN Eo * | _efl_network_url_eo_base_finalize (Efl_Network_Url *url_obj, Efl_Network_Url_Data *url_con)
static void | _ecore_con_url_free_internal (Ecore_Con_Url *url_obj)
static EOLIAN void | _efl_network_url_eo_base_destructor (Efl_Network_Url *url_obj, Efl_Network_Url_Data *url_con)
static EOLIAN const char * | _efl_network_url_url_get (Efl_Network_Url *url_obj, Efl_Network_Url_Data *url_con)
static EOLIAN Eina_Bool | _efl_network_url_url_set (Efl_Network_Url *url_obj, Efl_Network_Url_Data *url_con, const char *url)
static Eina_Bool | _ecore_con_url_send (Ecore_Con_Url *url_obj, Ecore_Con_Url_Mode mode, const void *data, long length, const char *content_type)

## Variables
Ecore_Con_Socks * | _ecore_con_proxy_global

## Detailed Description

Utility functions that set up, use and shut down the Ecore URL Connection library.

These functions are a shortcut to make it easy to perform http requests (POST, GET, etc).

Brief usage:

1. Create an Ecore_Con_Url object with ecore_con_url_new(url);
2. Register to receive the ECORE_CON_EVENT_URL_COMPLETE event (and optionally the ECORE_CON_EVENT_URL_DATA and ECORE_CON_EVENT_URL_PROGRESS event to receive the response, e.g. for HTTP/FTP downloads)
3. Perform the operation with ecore_con_url_get(...);

Note that it is good to reuse Ecore_Con_Url objects wherever possible, but bear in mind that each one can only perform one operation at a time. You need to wait for the ECORE_CON_EVENT_URL_COMPLETE event before re-using or destroying the object.

If it's necessary to change the Ecore_Con_Url object url, use ecore_con_url_url_set().

Simple Usage 1 (HTTP GET):

ecore_con_url_url_set(url_con, "http://www.google.com");
ecore_con_url_get(url_con);

Simple usage 2 (HTTP POST):

ecore_con_url_url_set(url_con, "http://www.example.com/post_handler.cgi");
ecore_con_url_post(url_con, data, data_length, "multipart/form-data");

Simple Usage 3 (FTP download):

fd = creat(filename, 0644)
ecore_con_url_url_set(url_con, "ftp://ftp.example.com/pub/myfile");
ecore_con_url_fd_set(url_con, fd);
ecore_con_url_get(url_con);

Simple Usage 4 (FTP upload as ftp://ftp.example.com/file):

ecore_con_url_url_set(url_con, "ftp://ftp.example.com");
ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass", NULL);

Simple Usage 5 (FTP upload as ftp://ftp.example.com/dir/file):

ecore_con_url_url_set(url_con, "ftp://ftp.example.com");
ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass","dir");

These are complete examples for the API:

- Downloading a file
- Setting many options for the connection

## Enumeration Type Documentation

enum _Ecore_Con_Url_Time

The type of condition to use when making an HTTP request dependent on time, so that headers such as "If-Modified-Since" are used.

Enumerator
ECORE_CON_URL_TIME_NONE | Do not place time restrictions on the HTTP requests.
ECORE_CON_URL_TIME_IFMODSINCE | Add the "If-Modified-Since" HTTP header, so that the request is performed by the server only if the target has been modified since the time value passed to it in the request.
ECORE_CON_URL_TIME_IFUNMODSINCE | Add the "If-Unmodified-Since" HTTP header, so that the request is performed by the server only if the target has NOT been modified since the time value passed to it in the request.

enum _Ecore_Con_Url_Http_Version

The http version to use.

Since
  1.2

Enumerator
ECORE_CON_URL_HTTP_VERSION_1_0 | HTTP version 1.0. Since 1.2
ECORE_CON_URL_HTTP_VERSION_1_1 | HTTP version 1.1 (default) Since 1.2

## Function Documentation

EAPI Eina_Bool ecore_con_url_http_version_set | ( | Ecore_Con_Url * | url_con,
|  | Ecore_Con_Url_Http_Version | version
| ) |  |

Change the HTTP version used for the request.

Parameters

  url_con | Connection object through which the request will be sent.
  version | The version to be used

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on failure to change version.

Since
  1.2

See also
  ecore_con_url_pipeline_get()

References ECORE_CON_URL_HTTP_VERSION_1_0, ECORE_CON_URL_HTTP_VERSION_1_1, EINA_FALSE, EINA_TRUE, eo_data_scope_get(), eo_isa(), and ERR.

EAPI int ecore_con_url_init | ( | void |  | ) |

Initialise the Ecore_Con_Url library.

Returns
  Number of times the library has been initialised without being shut down.

Note
  This function doesn't call ecore_con_init(). You still need to call it explicitly before calling this one.

Examples:
  ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, and ecore_con_url_headers_example.c.

References ECORE_CON_EVENT_URL_COMPLETE, ECORE_CON_EVENT_URL_DATA, ECORE_CON_EVENT_URL_PROGRESS, ecore_event_type_new(), and ecore_init().

EAPI int ecore_con_url_shutdown | ( | void |  | ) |

Shut down the Ecore_Con_Url library.

Returns
  Number of calls that still uses Ecore_Con_Url

Note
  This function doesn't call ecore_con_shutdown(). You still need to call it explicitly after calling this one.

Examples:
  ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, and ecore_con_url_headers_example.c.

References ecore_con_url_free(), ecore_main_fd_handler_del(), ecore_shutdown(), ecore_timer_del(), and EINA_LIST_FREE.

EAPI void ecore_con_url_pipeline_set | ( | Eina_Bool | enable | ) |

Enable or disable HTTP 1.1 pipelining.

Parameters

  enable | `EINA_TRUE` will turn it on, `EINA_FALSE` will disable it.

Pipelining allows to send one request after another one, without having to wait for the reply of the first request. The respective replies are received in the order that the requests were sent.

Enabling this feature will be valid for all requests done using `ecore_con_url`.

See http://en.wikipedia.org/wiki/HTTP_pipelining for more info.

See also
  ecore_con_url_pipeline_get()

Examples:
  ecore_con_url_headers_example.c.

EAPI Eina_Bool ecore_con_url_pipeline_get | ( | void |  | ) |

Is HTTP 1.1 pipelining enable ?

Returns
  `EINA_TRUE` if it is enable.

See also
  ecore_con_url_pipeline_set()

Examples:
  ecore_con_url_headers_example.c.

References _Ecore_Con_Event_Url_Data::data, _Ecore_Con_Event_Url_Progress::down, ECORE_CON_EVENT_URL_COMPLETE, ECORE_CON_EVENT_URL_DATA, ECORE_CON_EVENT_URL_PROGRESS, ecore_event_add(), EINA_UNUSED, EO_CALLBACK_CONTINUE, EO_CALLBACK_STOP, EO_CALLBACKS_ARRAY_DEFINE, _Ecore_Con_Event_Url_Progress::now, _Ecore_Con_Event_Url_Data::size, _Ecore_Con_Event_Url_Complete::status, _Ecore_Con_Event_Url_Progress::total, _Ecore_Con_Event_Url_Progress::up, _Ecore_Con_Event_Url_Data::url_con, _Ecore_Con_Event_Url_Complete::url_con, and _Ecore_Con_Event_Url_Progress::url_con.

EAPI Ecore_Con_Url * ecore_con_url_new | ( | const char * | url | ) |

Create and initialize a new Ecore_Con_Url connection object.

Parameters

  url | URL that will receive requests. Can be changed using ecore_con_url_url_set.

Returns
  `NULL` on error, a new Ecore_Con_Url on success.

Create and initialize a new Ecore_Con_Url connection object that can be used for sending requests.

See also
  ecore_con_url_custom_new()
  ecore_con_url_url_set()

Examples:
  ecore_con_url_cookies_example.c, and ecore_con_url_download_example.c.

References ecore_con_url_free(), ecore_con_url_proxy_set(), ecore_con_url_proxy_username_set(), EINA_FALSE, EINA_TRUE, eo_add, eo_event_callback_array_add, eo_manual_free_set(), and ERR.

Referenced by ecore_con_url_custom_new(), and ecore_file_download_protocol_available().

EAPI Ecore_Con_Url * ecore_con_url_custom_new | ( | const char * | url,
|  | const char * | custom_request
| ) |  |

Create a custom connection object.

Parameters

  url | URL that will receive requests
  custom_request | Custom request (e.g. GET, POST, HEAD, PUT, etc)

Returns
  `NULL` on error, a new Ecore_Con_Url on success.

Create and initialize a new Ecore_Con_Url for a custom request (e.g. HEAD, SUBSCRIBE and other obscure HTTP requests). This object should be used like one created with ecore_con_url_new().

See also
  ecore_con_url_new()
  ecore_con_url_url_set()

Examples:
  ecore_con_url_headers_example.c.

References ecore_con_url_free(), ecore_con_url_new(), eo_data_scope_get(), and ERR.

EAPI void ecore_con_url_free | ( | Ecore_Con_Url * | url_con | ) |

Destroy a Ecore_Con_Url connection object.

Parameters

  url_con | Connection object to free.

See also
  ecore_con_url_new()

Examples:
  ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, and ecore_con_url_headers_example.c.

References ecore_timer_del(), EINA_FALSE, EINA_LIST_FREE, eina_list_remove(), eina_stringshare_del(), EINA_TRUE, eo_data_scope_get(), eo_del(), eo_isa(), and eo_manual_free_set().

Referenced by ecore_con_url_custom_new(), ecore_con_url_new(), ecore_con_url_shutdown(), ecore_file_download_abort(), and ecore_file_download_protocol_available().

EAPI void ecore_con_url_data_set | ( | Ecore_Con_Url * | url_con,
|  | void * | data
| ) |  |

Associate data with a connection object.

Parameters

  url_con | Connection object to associate data.
  data | Data to be set.

Associate data with a connection object, which can be retrieved later with ecore_con_url_data_get()).

See also
  ecore_con_url_data_get()

Examples:
  ecore_con_url_download_example.c.

References eo_data_scope_get(), and eo_isa().

Referenced by ecore_file_download_protocol_available().

EAPI void * ecore_con_url_data_get | ( | Ecore_Con_Url * | url_con | ) |

Retrieve data associated with a Ecore_Con_Url connection object.

Parameters

  url_con | Connection object to retrieve data from.

Returns
  Data associated with the given object.

Retrieve data associated with a Ecore_Con_Url connection object (previously set with ecore_con_url_data_set()).

See also
  ecore_con_url_data_set()

Examples:
  ecore_con_url_download_example.c.

References eo_data_scope_get(), and eo_isa().

Referenced by ecore_file_download_abort(), and ecore_file_download_protocol_available().

EAPI void ecore_con_url_additional_header_add | ( | Ecore_Con_Url * | url_con,
|  | const char * | key,
|  | const char * | value
| ) |  |

Add an additional header to the request connection object.

Parameters

  url_con | Connection object
  key | Header key
  value | Header value

Add an additional header (User-Agent, Content-Type, etc.) to the request connection object. This addition will be valid for only one ecore_con_url_get() or ecore_con_url_post() call.

Some functions like ecore_con_url_time() also add headers to the request.

See also
  ecore_con_url_get()
  ecore_con_url_post()
  ecore_con_url_additional_headers_clear()

Examples:
  ecore_con_url_cookies_example.c, and ecore_con_url_headers_example.c.

References eina_list_append(), eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_additional_headers_clear | ( | Ecore_Con_Url * | url_con | ) |

Clean additional headers.

Parameters

  url_con | Connection object to clean additional headers.

Clean additional headers associated with a connection object (previously added with ecore_con_url_additional_header_add()).

See also
  ecore_con_url_additional_header_add()
  ecore_con_url_get()
  ecore_con_url_post()

References EINA_LIST_FREE, eo_data_scope_get(), and eo_isa().

EAPI const Eina_List * ecore_con_url_response_headers_get | ( | Ecore_Con_Url * | url_con | ) |

Retrieve headers from last request sent.

Parameters

  url_con | Connection object to retrieve response headers from.

Retrieve a list containing the response headers. This function should be used after an ECORE_CON_EVENT_URL_COMPLETE event (headers should normally be ready at that time).

Returns
  List of response headers. This list must not be modified by the user.

Examples:
  ecore_con_url_cookies_example.c, and ecore_con_url_headers_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_fd_set | ( | Ecore_Con_Url * | url_con,
|  | int | fd
| ) |  |

Set up a file for receiving response data.

Parameters

  url_con | Connection object to set file
  fd | File descriptor associated with the file. A negative value will unset any previously set fd.

Set up a file to have response data written into. Note that ECORE_CON_EVENT_URL_DATA events will not be emitted if a file has been set to receive the response data.

This call can be used to easily setup a file where the downloaded data will be saved.

Examples:
  ecore_con_url_download_example.c.

References eo_data_scope_get(), and eo_isa().

Referenced by ecore_file_download_protocol_available().

EAPI int ecore_con_url_received_bytes_get | ( | Ecore_Con_Url * | url_con | ) |

Retrieve the number of bytes received.

Retrieve the number of bytes received on the last request of the given connection object.

Parameters

  url_con | Connection object which the request was sent on.

Returns
  Number of bytes received on request.

See also
  ecore_con_url_get()
  ecore_con_url_post()

Examples:
  ecore_con_url_download_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI Eina_Bool ecore_con_url_httpauth_set | ( | Ecore_Con_Url * | url_con,
|  | const char * | username,
|  | const char * | password,
|  | Eina_Bool | safe
| ) |  |

Set url_con to use http auth, with given username and password, "safely" or not.

Parameters

  url_con | Connection object to perform a request on, previously created with ecore_con_url_new() or ecore_con_url_custom_new().
  username | Username to use in authentication
  password | Password to use in authentication
  safe | Whether to use "safer" methods (eg, NOT http basic auth)

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

Attention
  Require libcurl >= 7.19.1 to work, otherwise will always return `0`.

Examples:
  ecore_con_url_headers_example.c.

References ECORE_CON_URL_TIME_IFMODSINCE, ECORE_CON_URL_TIME_IFUNMODSINCE, ECORE_CON_URL_TIME_NONE, EINA_FALSE, EINA_LIST_FOREACH, EINA_LIST_FREE, EINA_TRUE, eo_data_scope_get(), eo_isa(), and ERR.

EAPI Eina_Bool ecore_con_url_get | ( | Ecore_Con_Url * | url_con | ) |

Send a get request.

Parameters

  url_con | Connection object to perform a request on, previously created

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

The request is performed immediately, but you need to setup event handlers for ECORE_CON_EVENT_URL_DATA, ECORE_CON_EVENT_URL_COMPLETE or ECORE_CON_EVENT_URL_PROGRESS to get more information about its result.

See also
  ecore_con_url_custom_new()
  ecore_con_url_additional_headers_clear()
  ecore_con_url_additional_header_add()
  ecore_con_url_data_set()
  ecore_con_url_data_get()
  ecore_con_url_response_headers_get()
  ecore_con_url_time()
  ecore_con_url_post()

Examples:
  ecore_con_url_cookies_example.c, ecore_con_url_download_example.c, and ecore_con_url_headers_example.c.

Referenced by ecore_file_download_protocol_available().

EAPI Eina_Bool ecore_con_url_head | ( | Ecore_Con_Url * | url_con | ) |

Send a HEAD request.

Parameters

  url_con | Connection object to perform a request on, previously created

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

The request is performed immediately, but you need to setup event handlers for ECORE_CON_EVENT_URL_COMPLETE or ECORE_CON_EVENT_URL_PROGRESS to get more information about its result.

See also
  ecore_con_url_custom_new()
  ecore_con_url_additional_headers_clear()
  ecore_con_url_additional_header_add()
  ecore_con_url_response_headers_get()
  ecore_con_url_time()
  ecore_con_url_post()

Since
  1.14

EAPI Eina_Bool ecore_con_url_post | ( | Ecore_Con_Url * | url_con,
|  | const void * | data,
|  | long | length,
|  | const char * | content_type
| ) |  |

Send a post request.

Parameters

  url_con | Connection object to perform a request on, previously created with ecore_con_url_new() or ecore_con_url_custom_new().
  data | Payload (data sent on the request). Can be `NULL`.
  length | Payload length. If `-1`, rely on automatic length calculation via `strlen()` on `data`.
  content_type | Content type of the payload (e.g. text/xml). Can be `NULL`.

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

The request starts immediately, but you need to setup event handlers for ECORE_CON_EVENT_URL_DATA, ECORE_CON_EVENT_URL_COMPLETE or ECORE_CON_EVENT_URL_PROGRESS to get more information about its result.

This call won't block your main loop.

See also
  ecore_con_url_custom_new()
  ecore_con_url_additional_headers_clear()
  ecore_con_url_additional_header_add()
  ecore_con_url_data_set()
  ecore_con_url_data_get()
  ecore_con_url_response_headers_get()
  ecore_con_url_time()
  ecore_con_url_get()

Examples:
  ecore_con_url_headers_example.c.

EAPI void ecore_con_url_time | ( | Ecore_Con_Url * | url_con,
|  | Ecore_Con_Url_Time | time_condition,
|  | double | timestamp
| ) |  |

Set whether HTTP requests should be conditional, dependent on modification time.

Parameters

  url_con | Ecore_Con_Url to act upon.
  time_condition | Condition to use for HTTP requests.
  timestamp | Time since 1 Jan 1970 to use in the condition.

This function may set the header "If-Modified-Since" or "If-Unmodified-Since", depending on the value of `time_condition`, with the value `timestamp`.

See also
  ecore_con_url_get()
  ecore_con_url_post()

Examples:
  ecore_con_url_headers_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI Eina_Bool ecore_con_url_ftp_upload | ( | Ecore_Con_Url * | url_con,
|  | const char * | filename,
|  | const char * | user,
|  | const char * | pass,
|  | const char * | upload_dir
| ) |  |

Upload a file to an ftp site.

Parameters

  url_con | The Ecore_Con_Url object to send with
  filename | The path to the file to send
  user | The username to log in with
  pass | The password to log in with
  upload_dir | The directory to which the file should be uploaded

Returns
  `EINA_TRUE` on success, `EINA_FALSE` otherwise.

Upload `filename` to an ftp server set in `url_con` using `user` and `pass` to directory `upload_dir`

References EINA_FALSE, eo_data_scope_get(), eo_isa(), and ERR.

EAPI void ecore_con_url_verbose_set | ( | Ecore_Con_Url * | url_con,
|  | Eina_Bool | verbose
| ) |  |

Toggle libcurl's verbose output.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.
  verbose | Whether or not to enable libcurl's verbose output.

If `verbose` is `EINA_TRUE`, libcurl will output a lot of verbose information about its operations, which is useful for debugging. The verbose information will be sent to stderr.

Examples:
  ecore_con_url_headers_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_ftp_use_epsv_set | ( | Ecore_Con_Url * | url_con,
|  | Eina_Bool | use_epsv
| ) |  |

Enable or disable EPSV extension.

Parameters

  url_con | The Ecore_Con_Url instance which will be acted upon.
  use_epsv | Boolean to enable/disable the EPSV extension.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_cookies_init | ( | Ecore_Con_Url * | url_con | ) |

Enable the cookie engine for subsequent HTTP requests.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.

After this function is called, cookies set by the server in HTTP responses will be parsed and stored, as well as sent back to the server in new HTTP requests.

Note
  Even though this function is called `ecore_con_url_cookies_init()`, there is no symmetrical shutdown operation.

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_cookies_ignore_old_session_set | ( | Ecore_Con_Url * | url_con,
|  | Eina_Bool | ignore
| ) |  |

Control whether session cookies from previous sessions shall be loaded.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.
  ignore | If `EINA_TRUE`, ignore session cookies when loading cookies from files. If `EINA_FALSE`, all cookies will be loaded.

Session cookies are cookies with no expire date set, which usually means they are removed after the current session is closed.

By default, when Ecore_Con_Url loads cookies from a file, all cookies are loaded, including session cookies, which, most of the time, were supposed to be loaded and valid only for that session.

If `ignore` is set to `EINA_TRUE`, when Ecore_Con_Url loads cookies from the files passed to `ecore_con_url_cookies_file_add()`, session cookies will not be loaded.

See also
  ecore_con_url_cookies_file_add()

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_cookies_clear | ( | Ecore_Con_Url * | url_con | ) |

Clear currently loaded cookies.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.

The cleared cookies are removed and will not be sent in subsequent HTTP requests, nor will they be written to the cookiejar file set via `ecore_con_url_cookies_jar_file_set()`.

Note
  This function will initialize the cookie engine if it has not been initialized yet.
  The cookie files set by ecore_con_url_cookies_file_add() aren't loaded immediately, just when the request is started. Thus, if you ask to clear the cookies, but has a file already set by that function, the cookies will then be loaded and you will have old cookies set. In order to don't have any old cookie set, you need to don't call ecore_con_url_cookies_file_add() ever on the `url_con` handler, and call this function to clear any cookie set by a previous request on this handler.

See also
  ecore_con_url_cookies_session_clear()
  ecore_con_url_cookies_ignore_old_session_set()

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_cookies_session_clear | ( | Ecore_Con_Url * | url_con | ) |

Clear currently loaded session cookies.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.

Session cookies are cookies with no expire date set, which usually means they are removed after the current session is closed.

The cleared cookies are removed and will not be sent in subsequent HTTP requests, nor will they be written to the cookiejar file set via `ecore_con_url_cookies_jar_file_set()`.

Note
  This function will initialize the cookie engine if it has not been initialized yet.
  The cookie files set by ecore_con_url_cookies_file_add() aren't loaded immediately, just when the request is started. Thus, if you ask to clear the session cookies, but has a file already set by that function, the session cookies will then be loaded and you will have old cookies set. In order to don't have any old session cookie set, you need to don't call ecore_con_url_cookies_file_add() ever on the `url_con` handler, and call this function to clear any session cookie set by a previous request on this handler. An easier way to don't use old session cookies is by using the function ecore_con_url_cookies_ignore_old_session_set().

See also
  ecore_con_url_cookies_clear()
  ecore_con_url_cookies_ignore_old_session_set()

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_cookies_file_add | ( | Ecore_Con_Url * | url_con,
|  | const char *const | file_name
| ) |  |

Add a file to the list of files from which to load cookies.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.
  file_name | Name of the file that will be added to the list.

Files must contain cookies defined according to two possible formats:

- HTTP-style header ("Set-Cookie: ...").
- Netscape/Mozilla cookie data format.

Cookies will only be read from this file. If you want to save cookies to a file, use ecore_con_url_cookies_jar_file_set(). Also notice that this function supports the both types of cookie file cited above, while ecore_con_url_cookies_jar_file_set() will save only in the Netscape/Mozilla's format.

Please notice that the file will not be read immediately, but rather added to a list of files that will be loaded and parsed at a later time.

Note
  This function will initialize the cookie engine if it has not been initialized yet.

See also
  ecore_con_url_cookies_ignore_old_session_set()
  ecore_con_url_cookies_jar_file_set()

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI Eina_Bool ecore_con_url_cookies_jar_file_set | ( | Ecore_Con_Url * | url_con,
|  | const char *const | cookiejar_file
| ) |  |

Set the name of the file to which all current cookies will be written when either cookies are flushed or Ecore_Con is shut down.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.
  cookiejar_file | File to which the cookies will be written.

Returns
  `EINA_TRUE` is the file name has been set successfully, `EINA_FALSE` otherwise.

Cookies are written following Netscape/Mozilla's data format, also known as cookie-jar.

Cookies will only be saved to this file. If you need to read cookies from a file, use ecore_con_url_cookies_file_add() instead.

Note
  This function will initialize the cookie engine if it has not been initialized yet.

See also
  ecore_con_url_cookies_jar_write()

Examples:
  ecore_con_url_cookies_example.c.

References EINA_FALSE, EINA_TRUE, eo_data_scope_get(), eo_isa(), and ERR.

EAPI void ecore_con_url_cookies_jar_write | ( | Ecore_Con_Url * | url_con | ) |

Write all current cookies to the cookie jar immediately.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.

A cookie-jar file must have been previously set by `ecore_con_url_jar_file_set`, otherwise nothing will be done.

Note
  This function will initialize the cookie engine if it has not been initialized yet.

See also
  ecore_con_url_cookies_jar_file_set()

Examples:
  ecore_con_url_cookies_example.c.

References eo_data_scope_get(), and eo_isa().

EAPI void ecore_con_url_ssl_verify_peer_set | ( | Ecore_Con_Url * | url_obj,
|  | Eina_Bool | verify
| ) |  |

Toggle libcurl's verify peer's certificate option.

If `verify` is `EINA_TRUE`, libcurl will verify the authenticity of the peer's certificate, otherwise it will not. Default behavior of libcurl is to check peer's certificate.

Parameters

  url_con | Ecore_Con_Url instance which will be acted upon.
  verify | Whether or not libcurl will check peer's certificate.

Since
  1.1.0

References eo_data_scope_get(), and eo_isa().

EAPI int ecore_con_url_ssl_ca_set | ( | Ecore_Con_Url * | url_obj,
|  | const char * | ca_path
| ) |  |

Set a custom CA to trust for SSL/TLS connections.

Specify the path of a file (in PEM format) containing one or more CA certificate(s) to use for the validation of the server certificate.

This function can also disable CA validation if `ca_path` is `NULL`. However, the server certificate still needs to be valid for the connection to succeed (i.e., the certificate must concern the server the connection is made to).

Parameters

  url_con | Connection object that will use the custom CA.
  ca_path | Path to a CA certificate(s) file or `NULL` to disable CA validation.

Returns
  `0` on success. When cURL is used, non-zero return values are equal to cURL error codes.

References eo_data_scope_get(), and eo_isa().

EAPI Eina_Bool ecore_con_url_proxy_set | ( | Ecore_Con_Url * | url_con,
|  | const char * | proxy
| ) |  |

Set HTTP proxy to use.

The parameter should be a char * to a zero terminated string holding the host name or dotted IP address. To specify port number in this string, append :[port] to the end of the host name. The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored. The proxy's port number may optionally be specified with the separate option. If not specified, libcurl will default to using port 1080 for proxies.

Parameters

  url_con | Connection object that will use the proxy.
  proxy | Porxy string or `NULL` to disable

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

Since
  1.2

References EINA_FALSE, EINA_TRUE, eo_data_scope_get(), eo_isa(), and ERR.

Referenced by ecore_con_url_new().

EAPI Eina_Bool ecore_con_url_proxy_username_set | ( | Ecore_Con_Url * | url_con,
|  | const char * | username
| ) |  |

Set zero terminated username to use for proxy.

If socks protocol is used for proxy, protocol should be socks5 and above.

Parameters

  url_con | Connection object that will use the proxy.
  username | Username string.

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

See also
  ecore_con_url_proxy_set()

Since
  1.2

References EINA_FALSE, EINA_TRUE, eo_data_scope_get(), eo_isa(), and ERR.

Referenced by ecore_con_url_new().

EAPI Eina_Bool ecore_con_url_proxy_password_set | ( | Ecore_Con_Url * | url_con,
|  | const char * | password
| ) |  |

Set zero terminated password to use for proxy.

If socks protocol is used for proxy, protocol should be socks5 and above.

Parameters

  url_con | Connection object that will use the proxy.
  password | Password string.

Returns
  `EINA_TRUE` on success, `EINA_FALSE` on error.

See also
  ecore_con_url_proxy_set()

Since
  1.2

References DBG, ECORE_CALLBACK_CANCEL, ECORE_CALLBACK_RENEW, ECORE_FD_ERROR, ECORE_FD_READ, ECORE_FD_WRITE, ecore_main_fd_handler_add(), ecore_main_fd_handler_del(), EINA_FALSE, eina_list_append(), EINA_LIST_FOREACH_SAFE, EINA_LIST_FREE, eina_list_remove(), EINA_TRUE, eo_data_scope_get(), eo_isa(), eo_manual_free(), ERR, and INF.

EAPI void ecore_con_url_timeout_set | ( | Ecore_Con_Url * | url_con,
|  | double | timeout
| ) |  |

Set timeout in seconds.

The maximum time in seconds that you allow the ecore con url transfer operation to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations.

Parameters

  url_con | Connection object that will use the timeout.
  timeout | time in seconds.

See also
  ecore_con_url_cookies_jar_file_set()

Since
  1.2

References ecore_timer_add(), ecore_timer_del(), eo_data_scope_get(), and eo_isa().

EAPI int ecore_con_url_status_code_get | ( | Ecore_Con_Url * | url_con | ) |

Get the returned HTTP STATUS code.

This is used to, at any time, try to return the status code for a transmission.

Parameters

  url_con | Connection object

Returns
  A valid HTTP STATUS code, or 0 on failure

Since
  1.2

Examples:
  ecore_con_url_download_example.c.

References EINA_FALSE, EINA_TRUE, eo_data_scope_get(), and eo_isa().