static int http_curl_progress_callback(void *, double, double, double, double);
static int http_curl_debug_callback(CURL *, curl_infotype, char *, size_t, void *);
-typedef struct {
- void ***tsrm_ctx;
- void *data;
-} http_curl_callback_ctx;
-
#define HTTP_CURL_CALLBACK_DATA(from, type, var) \
http_curl_callback_ctx *__CTX = (http_curl_callback_ctx *) (from); \
TSRMLS_FETCH_FROM_CTX(__CTX->tsrm_ctx); \
return data;
}
+ case COPY_CONTEXT:
+ {
+ zend_llist_add_element(&HTTP_G(request).copies.contexts, &data);
+ return data;
+ }
+
default:
{
return data;
}
/* }}} */
+/* {{{ _http_request_data_free_context(http_curl_callback_ctx **) */
+void _http_request_data_free_context(void *context)
+{
+ efree(*((http_curl_callback_ctx **) context));
+}
+/* }}} */
+
/* {{{ http_request_body *http_request_body_new() */
PHP_HTTP_API http_request_body *_http_request_body_new(TSRMLS_D)
{
HTTP_CURL_OPT(NOSIGNAL, 1);
#endif
#if LIBCURL_VERSION_NUM < 0x070c00
- HTTP_CURL_OPT(ERRORBUFFER, HTTP_G(request).curl.error);
+ HTTP_CURL_OPT(ERRORBUFFER, HTTP_G(request).error);
#endif
/* progress callback */
#if HTTP_DEBUG_REQPOOLS
fprintf(stderr, "Fetching data from request %p of pool %p\n", obj, obj->pool);
#endif
- http_request_object_responsehandler(obj, *req, NULL);
+ http_request_object_responsehandler(obj, *req);
}
/* }}} */
http_curl_callback_ctx *ctx = emalloc(sizeof(http_curl_callback_ctx));
TSRMLS_SET_CTX(ctx->tsrm_ctx);
ctx->data = data;
- return ctx;
+ return http_request_data_copy(COPY_CONTEXT, ctx);
}
/* }}} */