projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- implement accessors to messages response status text
[m6w6/ext-http]
/
http_request_object.c
diff --git
a/http_request_object.c
b/http_request_object.c
index a9bd3bb12c3a436c92efb4275f4c8f93525dd276..cd77474c319d99053a0d69efeb1d4dc5a9016375 100644
(file)
--- a/
http_request_object.c
+++ b/
http_request_object.c
@@
-12,10
+12,6
@@
/* $Id$ */
/* $Id$ */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#define HTTP_WANT_CURL
#include "php_http.h"
#define HTTP_WANT_CURL
#include "php_http.h"
@@
-144,6
+140,7
@@
HTTP_END_ARGS;
HTTP_EMPTY_ARGS(getResponseBody, 0);
HTTP_EMPTY_ARGS(getResponseCode, 0);
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;
HTTP_BEGIN_ARGS(getResponseInfo, 0, 0)
HTTP_ARG_VAL(name, 0)
HTTP_END_ARGS;
@@
-268,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(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)
HTTP_REQUEST_ME(getResponseBody, ZEND_ACC_PUBLIC)
HTTP_REQUEST_ME(getResponseInfo, ZEND_ACC_PUBLIC)
HTTP_REQUEST_ME(getResponseMessage, ZEND_ACC_PUBLIC)
@@
-361,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_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, "");
DCL_PROP(PRIVATE, long, method, HTTP_GET);
DCL_PROP(PRIVATE, string, url, "");
DCL_PROP(PRIVATE, string, contentType, "");
@@
-594,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(long, responseCode, msg->http.info.response.code);
+ UPD_PROP(string, responseStatus, msg->http.info.response.status);
MAKE_STD_ZVAL(resp);
array_init(resp);
MAKE_STD_ZVAL(resp);
array_init(resp);
@@
-607,7
+607,7
@@
STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this
zval_ptr_dtor(&resp);
MAKE_STD_ZVAL(message);
zval_ptr_dtor(&resp);
MAKE_STD_ZVAL(message);
- ZVAL_OBJVAL(message, http_message_object_new_ex(http_message_object_ce, msg, NULL));
+ ZVAL_OBJVAL(message, http_message_object_new_ex(http_message_object_ce, msg, NULL)
, 0
);
SET_PROP(responseMessage, message);
zval_ptr_dtor(&message);
SET_PROP(responseMessage, message);
zval_ptr_dtor(&message);
@@
-1017,7
+1017,6
@@
PHP_METHOD(HttpRequest, setContentType)
{
char *ctype;
int ct_len;
{
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;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ctype, &ct_len)) {
RETURN_FALSE;
@@
-1059,7
+1058,6
@@
PHP_METHOD(HttpRequest, getContentType)
PHP_METHOD(HttpRequest, setQueryData)
{
zval *qdata = NULL;
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;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!", &qdata)) {
RETURN_FALSE;
@@
-1647,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.
/* {{{ proto mixed HttpRequest::getResponseInfo([string name])
*
* Get response info after the request has been sent.
@@
-1717,7
+1731,7
@@
PHP_METHOD(HttpRequest, getResponseMessage)
SET_EH_THROW_HTTP();
message = GET_PROP(responseMessage);
if (Z_TYPE_P(message) == IS_OBJECT) {
SET_EH_THROW_HTTP();
message = GET_PROP(responseMessage);
if (Z_TYPE_P(message) == IS_OBJECT) {
- RETVAL_OBJECT(message);
+ RETVAL_OBJECT(message
, 1
);
} else {
RETVAL_NULL();
}
} else {
RETVAL_NULL();
}
@@
-1754,7
+1768,7
@@
PHP_METHOD(HttpRequest, getRequestMessage)
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)))) {
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)))) {
-
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL)
);
+
RETVAL_OBJVAL(http_message_object_new_ex(http_message_object_ce, msg, NULL), 0
);
}
SET_EH_NORMAL();
}
}
SET_EH_NORMAL();
}
@@
-1828,7
+1842,7
@@
PHP_METHOD(HttpRequest, getHistory)
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history)))) {
SET_EH_THROW_HTTP();
if ((msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history)))) {
-
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL)
);
+
RETVAL_OBJVAL(http_message_object_new_ex(http_message_object_ce, msg, NULL), 0
);
}
SET_EH_NORMAL();
}
}
SET_EH_NORMAL();
}
@@
-1908,7
+1922,7
@@
PHP_METHOD(HttpRequest, send)
} else if (SUCCESS == http_request_object_requesthandler(obj, getThis())) {
http_request_exec(obj->request);
if (SUCCESS == http_request_object_responsehandler(obj, getThis())) {
} else if (SUCCESS == http_request_object_requesthandler(obj, getThis())) {
http_request_exec(obj->request);
if (SUCCESS == http_request_object_responsehandler(obj, getThis())) {
- RETVAL_OBJECT(GET_PROP(responseMessage));
+ RETVAL_OBJECT(GET_PROP(responseMessage)
, 1
);
}
}
}
}