added ecore_con_url_status_code_get, cleaned up recent changelog/news entries, zero...
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 17:15:01 +0000 (17:15 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Mar 2012 17:15:01 +0000 (17:15 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@69009 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/ecore_con/Ecore_Con.h
src/lib/ecore_con/ecore_con_url.c

index e4702a7..ad6662a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2012-03-07  ChunEon Park (Hermet)
 
         * Add ecore_x_illume_clipboard_state_set()
-                  ecore_x_illume_clipboard_state_get()
-                                 ecore_x_illume_clipboard_geometry_set()
-                                 ecore_x_illume_clipboard_geometry_get()
+              ecore_x_illume_clipboard_state_get()
+              ecore_x_illume_clipboard_geometry_set()
+              ecore_x_illume_clipboard_geometry_get()
 
-2012-03-07 Carsten Haitzler (The Rasterman)
+2012-03-07  Carsten Haitzler (The Rasterman)
 
         * Add atoms and api for rotation and indicator transparency in
           ecore_x/ecore_evas
+
+2012-03-07  Mike Blumenkrantz (discomfitor/zmike)
+
+        * Add ecore_con_url_status_code_get() to check return code at any time
diff --git a/NEWS b/NEWS
index 5dc12a6..346bc0b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,9 +13,10 @@ Additions:
      - ECORE_CON_REMOTE_CORK
      - ecore_con_url_proxy_set()
      - ecore_con_url_timeout_set()
-     - ecore_con_url_proxy_username_set
+     - ecore_con_url_proxy_username_set()
      - ecore_con_url_proxy_password_set()
      - ecore_con_url_http_version_set()
+     - ecore_con_url_status_code_get()
     * ecore_x:
      - ecore_x_randr_output_backlight_available()
      - ecore_x_randr_window_crtcs_get()
index 0bf2b6f..9a67fdc 100644 (file)
@@ -1918,6 +1918,16 @@ EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const ch
 EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout);
 
 /**
+ * Get the returned HTTP STATUS code
+ *
+ * This is used to, at any time, try to return the status code for a transmission.
+ * @param url_con Connection object
+ * @return A valid HTTP STATUS code, or -1 on failure
+ *
+ * @since 1.2
+ */
+EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con);
+/**
  * @}
  */
 
index 90e8447..c52978b 100644 (file)
@@ -48,6 +48,7 @@ static void      _ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev);
 static Eina_Bool _ecore_con_url_timer(void *data);
 static Eina_Bool _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
 static Eina_Bool _ecore_con_url_timeout_cb(void *data);
+static void      _ecore_con_url_status_get(Ecore_Con_Url *url_con);
 
 static Eina_List *_url_con_list = NULL;
 static Eina_List *_fd_hd_list = NULL;
@@ -360,6 +361,24 @@ ecore_con_url_url_get(Ecore_Con_Url *url_con)
 #endif
 }
 
+EAPI int
+ecore_con_url_status_code_get(Ecore_Con_Url *url_con)
+{
+#ifdef HAVE_CURL
+   if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+     {
+        ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
+        return -1;
+     }
+
+   _ecore_con_url_status_get(url_con);
+   return url_con->status ?: -1;
+#else
+   return -1;
+   (void)url_con;
+#endif
+}
+
 EAPI Eina_Bool
 ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
 {
@@ -620,6 +639,7 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long len
    EINA_LIST_FREE(url_con->response_headers, s)
      free((char *)s);
    url_con->response_headers = NULL;
+   url_con->status = 0;
 
    curl_slist_free_all(url_con->headers);
    url_con->headers = NULL;
@@ -1270,8 +1290,12 @@ static void
 _ecore_con_url_status_get(Ecore_Con_Url *url_con)
 {
    long status = 0;
+
+   if (!url_con->curl_easy) return;
    if (curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status))
      url_con->status = status;
+   else
+     url_con->status = 0;
 }
 
 static void