X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_object.c;h=444516f53c450becab9bbdd728ca3c15c0b8697e;hp=055a43e8104b8047a7534d00c8c11d56e1373cf6;hb=902d195a198f4976c8ff081a95cdd3e315c14f5f;hpb=b272c1e03de58ff0c01f78421b824c7f45d43959 diff --git a/http_request_object.c b/http_request_object.c index 055a43e..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); @@ -208,7 +205,7 @@ void _http_request_object_free(zend_object *object TSRMLS_DC) STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ptr, http_request_body *body TSRMLS_DC) { zval *meth, *URL, *qdata, *opts; - char *request_uri, *uri; + char *request_uri; STATUS status; if (!body) { @@ -283,7 +280,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ body->data = Z_STRVAL_P(post); body->size = Z_STRLEN_P(post); - status = http_request_init(obj->ch, Z_LVAL_P(meth), uri, body, Z_ARRVAL_P(opts), &obj->response); + status = http_request_init(obj->ch, Z_LVAL_P(meth), request_uri, body, Z_ARRVAL_P(opts), &obj->response); } break; } @@ -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: