/**
* @typedef Ecore_Con_Url_Time
* @enum _Ecore_Con_Url_Time
- * The type of time in the object
+ * The type of condition to use when making an HTTP request dependent on time,
+ * so that headers such as "If-Modified-Since" are used.
*/
typedef enum _Ecore_Con_Url_Time
{
+ /**
+ * Do not place time restrictions on the HTTP requests.
+ */
ECORE_CON_URL_TIME_NONE = 0,
+ /**
+ * 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_IFMODSINCE,
- ECORE_CON_URL_TIME_IFUNMODSINCE,
- ECORE_CON_URL_TIME_LASTMOD
+ /**
+ * 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.
+ */
+ ECORE_CON_URL_TIME_IFUNMODSINCE
} Ecore_Con_Url_Time;
EAPI int ecore_con_url_init(void);
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);
+ Ecore_Con_Url_Time time_condition,
+ double timestamp);
EAPI Eina_Bool ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
const char *filename,
}
/**
- * FIXME
- * Sets the @ref Ecore_Con_Url object's condition/time members.
+ * Sets whether HTTP requests should be conditional, dependent on
+ * modification time.
+ *
+ * @param url_con Ecore_Con_Url to act upon.
+ * @param condition Condition to use for HTTP requests.
+ * @param timestamp Time since 1 Jan 1970 to use in the condition.
+ *
+ * @sa ecore_con_url_send()
*/
EAPI void
ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition,
- time_t tm)
+ double timestamp)
{
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
return;
}
- url_con->condition = condition;
- url_con->time = tm;
+ url_con->time_condition = condition;
+ url_con->timestamp = timestamp;
#else
return;
- url_con = NULL;
- condition = 0;
- tm = 0;
+ (void)url_con;
+ (void)condition;
+ (void)timestamp;
#endif
}
* @see ecore_con_url_data_set()
* @see ecore_con_url_data_get()
* @see ecore_con_url_response_headers_get()
+ * @see ecore_con_url_time()
*/
EAPI Eina_Bool
ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length,
url_con->headers = curl_slist_append(url_con->headers, tmp);
}
- switch (url_con->condition)
+ switch (url_con->time_condition)
{
case ECORE_CON_URL_TIME_NONE:
curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
case ECORE_CON_URL_TIME_IFMODSINCE:
curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_IFMODSINCE);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE,
+ (long)url_con->timestamp);
break;
case ECORE_CON_URL_TIME_IFUNMODSINCE:
curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_IFUNMODSINCE);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
- break;
-
- case ECORE_CON_URL_TIME_LASTMOD:
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
- CURL_TIMECOND_LASTMOD);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE,
+ (long)url_con->timestamp);
break;
}