EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url);
EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd);
EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con);
+ EAPI int ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe);
EAPI int ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length, const char *content_type);
EAPI void ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t tm);
}
/**
+ * Sets url_con to use http auth, with given username and password, "safely" or not.
+ *
+ * @param url_con Connection object to perform a request on, previously created
+ * with ecore_con_url_new() or ecore_con_url_custom_new().
+ * @param username Username to use in authentication
+ * @param password Password to use in authentication
+ * @param safe Whether to use "safer" methods (eg, NOT http basic auth)
+ *
+ * @return 1 on success, 0 on error.
+ *
+ * @ingroup Ecore_Con_Url_Group
+ */
+EAPI int
+ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
+{
+#ifdef HAVE_CURL
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_httpauth_set");
+ return 0;
+ }
+ if ((username != NULL) && (password != NULL))
+ {
+ if (safe)
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
+ else
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
+ }
+ return 0;
+#endif
+}
+
+/**
* Sends a request.
*
* @param url_con Connection object to perform a request on, previously created