billiob pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3a7b9a86cfff3a42f3df9883d18ef949fbd81899

commit 3a7b9a86cfff3a42f3df9883d18ef949fbd81899
Author: Boris Faure <bill...@gmail.com>
Date:   Mon Feb 9 21:23:32 2015 +0100

    ecore_con_url: add ecore_con_url_head()
    
    Just like ecore_con_url_get() or ecore_con_url_post() but to a HTTP HEAD.
    
    @feature
---
 src/lib/ecore_con/Ecore_Con.h     | 20 ++++++++++++++++++++
 src/lib/ecore_con/ecore_con_url.c | 14 ++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_con/Ecore_Con.h b/src/lib/ecore_con/Ecore_Con.h
index 41a1e90..9ade837 100644
--- a/src/lib/ecore_con/Ecore_Con.h
+++ b/src/lib/ecore_con/Ecore_Con.h
@@ -1555,6 +1555,26 @@ EAPI Eina_Bool         
ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
  */
 EAPI Eina_Bool         ecore_con_url_get(Ecore_Con_Url *url_con);
 /**
+ * Sends a HEAD request.
+ *
+ * @param url_con Connection object to perform a request on, previously created
+ *
+ * @return @c EINA_TRUE on success, @c 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 ecore_con_url_custom_new()
+ * @see ecore_con_url_additional_headers_clear()
+ * @see ecore_con_url_additional_header_add()
+ * @see ecore_con_url_response_headers_get()
+ * @see ecore_con_url_time()
+ * @see ecore_con_url_post()
+ * @since 1.14
+ */
+EAPI Eina_Bool         ecore_con_url_head(Ecore_Con_Url *url_con);
+/**
  * Sends a post request.
  *
  * @param url_con Connection object to perform a request on, previously created
diff --git a/src/lib/ecore_con/ecore_con_url.c 
b/src/lib/ecore_con/ecore_con_url.c
index 22c2a97..18fd566 100644
--- a/src/lib/ecore_con/ecore_con_url.c
+++ b/src/lib/ecore_con/ecore_con_url.c
@@ -32,9 +32,9 @@
 
 #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 actually USE.
 // 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 curl headers to get them from
 typedef enum
 {
    CURLM_CALL_MULTI_PERFORM = -1,
@@ -68,6 +68,7 @@ typedef enum
    CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
    CINIT(VERBOSE, LONG, 41),
    CINIT(NOPROGRESS, LONG, 43),
+   CINIT(NOBODY, LONG, 44),
    CINIT(UPLOAD, LONG, 46),
    CINIT(POST, LONG, 47),
    CINIT(FOLLOWLOCATION, LONG, 52),
@@ -188,6 +189,7 @@ typedef enum _Ecore_Con_Url_Mode
    ECORE_CON_URL_MODE_AUTO = 0,
    ECORE_CON_URL_MODE_GET = 1,
    ECORE_CON_URL_MODE_POST = 2,
+   ECORE_CON_URL_MODE_HEAD = 3,
 } Ecore_Con_Url_Mode;
 
 typedef struct _Ecore_Con_Curl Ecore_Con_Curl;
@@ -846,6 +848,8 @@ _ecore_con_url_send(Ecore_Con_Url *url_obj, 
Ecore_Con_Url_Mode mode,
         if (mode == ECORE_CON_URL_MODE_POST)
           _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_POST, 1);
      }
+   else if (mode == ECORE_CON_URL_MODE_HEAD)
+     _c->curl_easy_setopt(url_con->curl_easy, CURLOPT_NOBODY, 1L);
 
    switch (url_con->time_condition)
      {
@@ -885,6 +889,12 @@ ecore_con_url_get(Ecore_Con_Url *url_con)
 }
 
 EAPI Eina_Bool
+ecore_con_url_head(Ecore_Con_Url *url_con)
+{
+   return _ecore_con_url_send(url_con, ECORE_CON_URL_MODE_HEAD, NULL, 0, NULL);
+}
+
+EAPI Eina_Bool
 ecore_con_url_post(Ecore_Con_Url *url_con, const void *data, long length, 
const char *content_type)
 {
    return _ecore_con_url_send(url_con, ECORE_CON_URL_MODE_POST, data, length, 
content_type);

-- 


Reply via email to