-static int http_curl_debug_callback(CURL *, curl_infotype, char *, size_t, void *);
+static int http_curl_raw_callback(CURL *, curl_infotype, char *, size_t, void *);
+static int http_curl_dummy_callback(char *data, size_t n, size_t l, void *s) { return n*l; }
+
+
+/* {{{ http_request_callback_ctx http_request_callback_data(void *) */
+http_request_callback_ctx *_http_request_callback_data_ex(void *data, zend_bool cpy TSRMLS_DC)
+{
+ http_request_callback_ctx *ctx = emalloc(sizeof(http_request_callback_ctx));
+
+ TSRMLS_SET_CTX(ctx->tsrm_ctx);
+ ctx->data = data;
+
+ if (cpy) {
+ return http_request_data_copy(COPY_CONTEXT, ctx);
+ } else {
+ return ctx;
+ }
+}
+/* }}} */
+
+/* {{{ void *http_request_data_copy(int, void *) */
+void *_http_request_data_copy(int type, void *data TSRMLS_DC)
+{
+ switch (type)
+ {
+ case COPY_STRING:
+ {
+ char *new_str = estrdup(data);
+ zend_llist_add_element(&HTTP_G(request).copies.strings, &new_str);
+ return new_str;
+ }
+
+ case COPY_SLIST:
+ {
+ zend_llist_add_element(&HTTP_G(request).copies.slists, &data);
+ return data;
+ }
+
+ case COPY_CONTEXT:
+ {
+ zend_llist_add_element(&HTTP_G(request).copies.contexts, &data);
+ return data;
+ }
+
+ case COPY_CONV:
+ {
+ zend_llist_add_element(&HTTP_G(request).copies.convs, &data);
+ return data;
+ }
+
+ default:
+ {
+ return data;
+ }
+ }
+}
+/* }}} */