+/* {{{ STATUS http_request_enable_cookies(http_request *) */
+PHP_HTTP_API STATUS _http_request_enable_cookies(http_request *request)
+{
+ TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
+ if (CURLE_OK == curl_easy_setopt(request->ch, CURLOPT_COOKIEFILE, "")) {
+ return SUCCESS;
+ }
+ http_error(HE_WARNING, HTTP_E_REQUEST, "Could not enable cookies for this session");
+ return FAILURE;
+}
+/* }}} */
+
+/* {{{ STATUS http_request_reset_cookies(http_request *, int) */
+PHP_HTTP_API STATUS _http_request_reset_cookies(http_request *request, int session_only)
+{
+ TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
+
+ if (session_only) {
+#if HTTP_CURL_VERSION(7,15,4)
+ curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "SESS");
+ return SUCCESS;
+#else
+ http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset session cookies (need libcurl >= v7.15.4)");
+#endif
+ } else {
+#if HTTP_CURL_VERSION(7,14,1)
+ curl_easy_setopt(request->ch, CURLOPT_COOKIELIST, "ALL");
+ return SUCCESS;
+#else
+ http_error(HE_WARNING, HTTP_E_REQUEST, "Could not reset cookies (need libcurl >= v7.14.1)");
+#endif
+ }
+ return FAILURE;
+}
+/* }}} */
+