- Fixed build on php-trunk
[m6w6/ext-http] / php_http_request_api.h
index 22a497271d6908164b1959cf26d43dabd25d6181..bebceaebe8f90e49e1305af8c758d18ce2a86697 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2007, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -57,6 +57,31 @@ typedef struct _http_request_t {
 
 } http_request;
 
+#ifndef pestrndup
+#      define pestrndup(s,l,p) _pestrndup((s),(l),(p))
+static inline void *_pestrndup(const void *s, size_t l, int p)
+{
+       void *d = pemalloc(l+1, p);
+       memcpy(d, s, l);
+       ((char *) d)[l] = '\0';
+       return d;
+}
+#endif
+
+/* CURLOPT_PRIVATE storage living as long as a CURL handle */
+typedef struct _http_request_storage_t {
+       char *url;
+       char *cookiestore;
+       char errorbuffer[CURL_ERROR_SIZE];
+} http_request_storage;
+
+static inline http_request_storage *http_request_storage_get(CURL *ch)
+{
+       http_request_storage *st = NULL;
+       curl_easy_getinfo(ch, CURLINFO_PRIVATE, &st);
+       return st;
+}
+
 #define http_curl_init(r) http_curl_init_ex(NULL, (r))
 #define http_curl_init_ex(c, r) _http_curl_init_ex((c), (r) TSRMLS_CC)
 PHP_HTTP_API CURL *_http_curl_init_ex(CURL *ch, http_request *request TSRMLS_DC);
@@ -87,6 +112,9 @@ PHP_HTTP_API STATUS _http_request_enable_cookies(http_request *request);
 #define http_request_reset_cookies(r, s) _http_request_reset_cookies((r), (s))
 PHP_HTTP_API STATUS _http_request_reset_cookies(http_request *request, int session_only);
 
+#define http_request_flush_cookies(r) _http_request_flush_cookies(r)
+PHP_HTTP_API STATUS _http_request_flush_cookies(http_request *request);
+
 #define http_request_defaults(r) _http_request_defaults(r)
 PHP_HTTP_API void _http_request_defaults(http_request *request);