X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_object.c;h=cd77474c319d99053a0d69efeb1d4dc5a9016375;hb=f711df8e83b62938c05c2bf4ea544f095e80a2e9;hp=e6ed74ae0aaafd0dd2e876e746296e8322bdc08e;hpb=389e280e0bba312ff5ca9981801cc842dad26ec2;p=m6w6%2Fext-http diff --git a/http_request_object.c b/http_request_object.c index e6ed74a..cd77474 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -140,6 +140,7 @@ HTTP_END_ARGS; HTTP_EMPTY_ARGS(getResponseBody, 0); HTTP_EMPTY_ARGS(getResponseCode, 0); +HTTP_EMPTY_ARGS(getResponseStatus, 0); HTTP_BEGIN_ARGS(getResponseInfo, 0, 0) HTTP_ARG_VAL(name, 0) HTTP_END_ARGS; @@ -264,6 +265,7 @@ zend_function_entry http_request_object_fe[] = { HTTP_REQUEST_ME(getResponseHeader, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseCookie, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseCode, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(getResponseStatus, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseBody, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseInfo, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseMessage, ZEND_ACC_PUBLIC) @@ -357,6 +359,7 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D) DCL_PROP_N(PRIVATE, responseData); DCL_PROP_N(PRIVATE, responseMessage); DCL_PROP(PRIVATE, long, responseCode, 0); + DCL_PROP(PRIVATE, string, responseStatus, ""); DCL_PROP(PRIVATE, long, method, HTTP_GET); DCL_PROP(PRIVATE, string, url, ""); DCL_PROP(PRIVATE, string, contentType, ""); @@ -590,6 +593,7 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this } UPD_PROP(long, responseCode, msg->http.info.response.code); + UPD_PROP(string, responseStatus, msg->http.info.response.status); MAKE_STD_ZVAL(resp); array_init(resp); @@ -1013,7 +1017,6 @@ PHP_METHOD(HttpRequest, setContentType) { char *ctype; int ct_len; - getObject(http_request_object, obj); if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ctype, &ct_len)) { RETURN_FALSE; @@ -1055,7 +1058,6 @@ PHP_METHOD(HttpRequest, getContentType) PHP_METHOD(HttpRequest, setQueryData) { zval *qdata = NULL; - getObject(http_request_object, obj); if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!", &qdata)) { RETURN_FALSE; @@ -1643,6 +1645,22 @@ PHP_METHOD(HttpRequest, getResponseCode) } /* }}} */ +/* {{{ proto string HttpRequest::getResponseStatus() + * + * Get the response status (i.e. the string after the response code) after the message has been sent. + * + * Returns a string containing the response status text. + */ +PHP_METHOD(HttpRequest, getResponseStatus) +{ + NO_ARGS; + + IF_RETVAL_USED { + RETURN_PROP(responseStatus); + } +} +/* }}} */ + /* {{{ proto mixed HttpRequest::getResponseInfo([string name]) * * Get response info after the request has been sent.