}
if (SUCCESS == (status = http_request_object_requesthandler(obj, getThis(), &body))) {
- zval *info = GET_PROP(obj, responseInfo);
- status = http_request_exec(obj->ch, Z_ARRVAL_P(info));
- SET_PROP(obj, responseInfo, info);
+ status = http_request_exec(obj->ch, NULL);
}
http_request_body_dtor(&body);
/* final data handling */
if (SUCCESS == status) {
- status = http_request_object_responsehandler(obj, getThis(), NULL);
+ status = http_request_object_responsehandler(obj, getThis());
}
SET_EH_NORMAL();
#if LIBCURL_VERSION_NUM < 0x070c00
# define curl_easy_strerror(code) HTTP_G(request).error
+# ifndef curl_multi_strerror
+ static char *curl_multi_strerror(int code)
+ {
+ char message[256] = {0};
+ snprintf(message, 255, "Unknown HttpRequestPool error (curl multi code: %d)", code);
+ return http_request_data_copy(COPY_STRING, message);
+ }
+#endif
#endif
#define HTTP_CURL_INFO(I) HTTP_CURL_INFO_EX(I, I)
#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);
}
/* }}} */
return status;
}
-STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this_ptr, HashTable *info TSRMLS_DC)
+STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this_ptr TSRMLS_DC)
{
http_message *msg;
if (msg = http_message_parse(PHPSTR_VAL(&obj->response), PHPSTR_LEN(&obj->response))) {
char *body;
size_t body_len;
- zval *headers, *message = GET_PROP(obj, responseMessage), *resp = GET_PROP(obj, responseData);
+ zval *headers, *message, *resp = GET_PROP(obj, responseData), *info = GET_PROP(obj, responseInfo);
UPD_PROP(obj, long, responseCode, msg->info.response.code);
add_assoc_zval(resp, "headers", headers);
add_assoc_stringl(resp, "body", body, body_len, 0);
- //zval_dtor(&message);
+ MAKE_STD_ZVAL(message);
Z_TYPE_P(message) = IS_OBJECT;
message->value.obj = http_message_object_from_msg(msg);
SET_PROP(obj, responseMessage, message);
- if (info) {
- http_request_info(obj->ch, info);
- }
+ http_request_info(obj->ch, Z_ARRVAL_P(info));
+ SET_PROP(obj, responseInfo, info);
return SUCCESS;
}
#define http_request_object_requesthandler(req, this, body) _http_request_object_requesthandler((req), (this), (body) TSRMLS_CC)
extern STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ptr, http_request_body *body TSRMLS_DC);
-#define http_request_object_responsehandler(req, this, info) _http_request_object_responsehandler((req), (this), (info) TSRMLS_CC)
-extern STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this_ptr, HashTable *info TSRMLS_DC);
+#define http_request_object_responsehandler(req, this) _http_request_object_responsehandler((req), (this) TSRMLS_CC)
+extern STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this_ptr TSRMLS_DC);
PHP_METHOD(HttpRequest, __construct);
PHP_METHOD(HttpRequest, __destruct);