X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_methods.c;h=08959ed0c152c9c2ec0e490bc5e57de4b23543cf;hb=902d195a198f4976c8ff081a95cdd3e315c14f5f;hp=d71c2caa6d4d7a5f4756ac6baabea975c6eabba0;hpb=92d91587592727bbf0369e6eae8eba157063274d;p=m6w6%2Fext-http diff --git a/http_methods.c b/http_methods.c index d71c2ca..08959ed 100644 --- a/http_methods.c +++ b/http_methods.c @@ -18,8 +18,10 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif - #include "php.h" + +#ifdef ZEND_ENGINE_2 + #include "php_streams.h" #include "php_http.h" @@ -40,11 +42,9 @@ #include "php_http_requestpool_object.h" #include "php_http_exception_object.h" -#ifdef ZEND_ENGINE_2 - #include "missing.h" -ZEND_EXTERN_MODULE_GLOBALS(http) +ZEND_EXTERN_MODULE_GLOBALS(http); /* {{{ HttpResponse */ @@ -1133,7 +1133,7 @@ PHP_METHOD(HttpRequest, __destruct) PHP_METHOD(HttpRequest, setOptions) { char *key = NULL; - long idx = 0; + ulong idx = 0; zval *opts, *old_opts, **opt; getObject(http_request_object, obj); @@ -2069,7 +2069,11 @@ PHP_METHOD(HttpRequest, getResponseMessage) getObject(http_request_object, obj); message = GET_PROP(obj, responseMessage); - RETVAL_OBJECT(message); + if (Z_TYPE_P(message) == IS_OBJECT) { + RETVAL_OBJECT(message); + } else { + RETURN_NULL(); + } } } /* }}} */ @@ -2156,8 +2160,8 @@ PHP_METHOD(HttpRequest, send) * } * $pool->send(); * foreach ($urls as $url) { - * printf("%s (%s) is %s\n", - * $url, $req[$url]->getResponseInfo('effective_url'), + * printf("%s (%s) is %s\n", + * $url, $req[$url]->getResponseInfo('effective_url'), * $r->getResponseCode() == 200 ? 'alive' : 'not alive' * ); * } @@ -2255,11 +2259,16 @@ PHP_METHOD(HttpRequestPool, detach) */ PHP_METHOD(HttpRequestPool, send) { + STATUS status; getObject(http_requestpool_object, obj); NO_ARGS; - RETURN_SUCCESS(http_request_pool_send(&obj->pool)); + SET_EH_THROW_HTTP(); + status = http_request_pool_send(&obj->pool); + SET_EH_NORMAL(); + + RETURN_SUCCESS(status); } /* }}} */