X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_object.c;h=444516f53c450becab9bbdd728ca3c15c0b8697e;hb=5178ff512e676873a875cff22f65468d2d325fde;hp=1c99c8c215e90231fc8a5c17634db91bf7bc8e1b;hpb=e32f6fed32939bba9839c0e4f7cdaec02d8828dd;p=m6w6%2Fext-http diff --git a/http_request_object.c b/http_request_object.c index 1c99c8c..444516f 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -19,26 +19,23 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif - -#ifdef HTTP_HAVE_CURL -# ifdef PHP_WIN32 -# include -# endif -# include -#endif - #include "php.h" +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) + #include "php_http_std_defs.h" #include "php_http_request_object.h" #include "php_http_request_api.h" +#include "php_http_request_pool_api.h" #include "php_http_api.h" #include "php_http_url_api.h" #include "php_http_message_api.h" #include "php_http_message_object.h" -#ifdef ZEND_ENGINE_2 -#ifdef HTTP_HAVE_CURL +#ifdef PHP_WIN32 +# include +#endif +#include #define http_request_object_declare_default_properties() _http_request_object_declare_default_properties(TSRMLS_C) static inline void _http_request_object_declare_default_properties(TSRMLS_D); @@ -292,7 +289,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ 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; @@ -301,7 +298,7 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this 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); @@ -314,22 +311,22 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this add_assoc_zval(resp, "headers", headers); add_assoc_stringl(resp, "body", body, body_len, 0); - //zval_dtor(&message); - Z_TYPE_P(message) = IS_OBJECT; + MAKE_STD_ZVAL(message); + message->type = IS_OBJECT; + message->is_ref = 1; message->value.obj = http_message_object_from_msg(msg); SET_PROP(obj, responseMessage, message); + zval_ptr_dtor(&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; } return FAILURE; } -#endif /* HTTP_HAVE_CURL */ -#endif /* ZEND_ENGINE_2 */ +#endif /* ZEND_ENGINE_2 && HTTP_HAVE_CURL */ /* * Local variables: