#define HTTP_EMPTY_ARGS(method) HTTP_EMPTY_ARGS_EX(HttpRequest, method, 0)
#define HTTP_REQUEST_ME(method, visibility) PHP_ME(HttpRequest, method, HTTP_ARGS(HttpRequest, method), visibility)
#define HTTP_REQUEST_ALIAS(method, func) HTTP_STATIC_ME_ALIAS(method, func, HTTP_ARGS(HttpRequest, method))
+#define HTTP_REQUEST_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpRequest_##al), HTTP_ARGS(HttpRequest, al), vis)
HTTP_BEGIN_ARGS(__construct, 0)
HTTP_ARG_VAL(url, 0)
HTTP_ARG_VAL(content_type, 0)
HTTP_END_ARGS;
-HTTP_EMPTY_ARGS(getRawPostData);
-HTTP_BEGIN_ARGS(setRawPostData, 0)
- HTTP_ARG_VAL(raw_post_data, 0)
+HTTP_EMPTY_ARGS(getBody);
+HTTP_BEGIN_ARGS(setBody, 0)
+ HTTP_ARG_VAL(request_body_data, 0)
HTTP_END_ARGS;
-HTTP_BEGIN_ARGS(addRawPostData, 1)
- HTTP_ARG_VAL(raw_post_data, 0)
+HTTP_BEGIN_ARGS(addBody, 1)
+ HTTP_ARG_VAL(request_body_data, 0)
HTTP_END_ARGS;
HTTP_EMPTY_ARGS(getPutFile);
HTTP_REQUEST_ME(getPostFields, ZEND_ACC_PUBLIC)
HTTP_REQUEST_ME(addPostFields, ZEND_ACC_PUBLIC)
- HTTP_REQUEST_ME(setRawPostData, ZEND_ACC_PUBLIC)
- HTTP_REQUEST_ME(getRawPostData, ZEND_ACC_PUBLIC)
- HTTP_REQUEST_ME(addRawPostData, ZEND_ACC_PUBLIC)
+ HTTP_REQUEST_ME(setBody, ZEND_ACC_PUBLIC)
+ HTTP_REQUEST_ME(getBody, ZEND_ACC_PUBLIC)
+ HTTP_REQUEST_ME(addBody, ZEND_ACC_PUBLIC)
+ HTTP_REQUEST_MALIAS(setRawPostData, setBody, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
+ HTTP_REQUEST_MALIAS(getRawPostData, getBody, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
+ HTTP_REQUEST_MALIAS(addRawPostData, addBody, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
HTTP_REQUEST_ME(setPostFiles, ZEND_ACC_PUBLIC)
HTTP_REQUEST_ME(addPostFile, ZEND_ACC_PUBLIC)
DCL_PROP(PRIVATE, long, method, HTTP_GET);
DCL_PROP(PRIVATE, string, url, "");
DCL_PROP(PRIVATE, string, contentType, "");
- DCL_PROP(PRIVATE, string, rawPostData, "");
+ DCL_PROP(PRIVATE, string, requestBody, "");
DCL_PROP(PRIVATE, string, queryData, "");
DCL_PROP(PRIVATE, string, putFile, "");
DCL_PROP(PRIVATE, string, putData, "");
case HTTP_POST:
default:
{
- /* check for raw post data */
- zval *raw_data = GET_PROP(rawPostData);
+ /* check for raw request body */
+ zval *raw_data = GET_PROP(requestBody);
if (Z_STRLEN_P(raw_data)) {
http_request_object_check_request_content_type(getThis());
}
/* }}} */
-/* {{{ proto bool HttpRequest::setRawPostData([string raw_post_data])
- Set raw post data to send, overwriting previously set raw post data. Don't forget to specify a content type. */
-PHP_METHOD(HttpRequest, setRawPostData)
+/* {{{ proto bool HttpRequest::setBody([string request_body_data])
+ Set request body to send, overwriting previously set request body. Don't forget to specify a content type. */
+PHP_METHOD(HttpRequest, setBody)
{
char *raw_data = NULL;
int data_len = 0;
raw_data = "";
}
- UPD_STRL(rawPostData, raw_data, data_len);
+ UPD_STRL(requestBody, raw_data, data_len);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto bool HttpRequest::addRawPostData(string raw_post_data)
- Add raw post data, leaving previously set raw post data unchanged. */
-PHP_METHOD(HttpRequest, addRawPostData)
+/* {{{ proto bool HttpRequest::addBody(string request_body_data)
+ Add request body data, leaving previously set request body data unchanged. */
+PHP_METHOD(HttpRequest, addBody)
{
char *raw_data;
int data_len;
}
if (data_len) {
- zval *data = GET_PROP(rawPostData);
+ zval *data = GET_PROP(rrequestBody);
if (Z_STRLEN_P(data)) {
Z_STRVAL_P(data) = erealloc(Z_STRVAL_P(data), (Z_STRLEN_P(data) += data_len) + 1);
}
/* }}} */
-/* {{{ proto string HttpRequest::getRawPostData()
- Get previously set raw post data. */
-PHP_METHOD(HttpRequest, getRawPostData)
+/* {{{ proto string HttpRequest::getBody()
+ Get previously set request body data. */
+PHP_METHOD(HttpRequest, getBody)
{
NO_ARGS;
if (return_value_used) {
- RETURN_PROP(rawPostData);
+ RETURN_PROP(requestBody);
}
}
/* }}} */
#include "php_version.h"
+#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION == 0)
+# define WONKY
+#endif
+
#ifndef pemalloc_rel
# define pemalloc_rel(size, persistent) ((persistent)?malloc(size):emalloc_rel(size))
#endif
-#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION == 0)
-# define WONKY
+#ifndef ZEND_ACC_DEPRECATED
+# define ZEND_ACC_DEPRECATED 0
+#endif
+
+#if PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10
+# define php_url_parse_ex(u, l) php_url_parse(u)
+#endif
+
+#ifndef TSRMLS_FETCH_FROM_CTX
+# ifdef ZTS
+# define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
+# else
+# define TSRMLS_FETCH_FROM_CTX(ctx)
+# endif
+#endif
+
+#ifndef TSRMLS_SET_CTX
+# ifdef ZTS
+# define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
+# else
+# define TSRMLS_SET_CTX(ctx)
+# endif
+#endif
+
+#ifndef ZVAL_ZVAL
+#define ZVAL_ZVAL(z, zv, copy, dtor) { \
+ int is_ref, refcount; \
+ is_ref = (z)->is_ref; \
+ refcount = (z)->refcount; \
+ *(z) = *(zv); \
+ if (copy) { \
+ zval_copy_ctor(z); \
+ } \
+ if (dtor) { \
+ if (!copy) { \
+ ZVAL_NULL(zv); \
+ } \
+ zval_ptr_dtor(&zv); \
+ } \
+ (z)->is_ref = is_ref; \
+ (z)->refcount = refcount; \
+ }
+#endif
+#ifndef RETVAL_ZVAL
+#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
+#endif
+#ifndef RETURN_ZVAL
+#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
#endif
#ifdef WONKY
# define ZEND_EXCEPTION_GET_DEFAULT() zend_exception_get_default()
#endif
-#if PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10
-# define php_url_parse_ex(u, l) php_url_parse(u)
-#endif
-
#ifndef E_THROW
# define E_THROW 0
#endif
# define curl_multi_strerror(dummy) "unknown error"
#endif
-#ifndef TSRMLS_FETCH_FROM_CTX
-# ifdef ZTS
-# define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
-# else
-# define TSRMLS_FETCH_FROM_CTX(ctx)
-# endif
-#endif
-
-#ifndef TSRMLS_SET_CTX
-# ifdef ZTS
-# define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
-# else
-# define TSRMLS_SET_CTX(ctx)
-# endif
-#endif
-
-#ifndef ZVAL_ZVAL
-#define ZVAL_ZVAL(z, zv, copy, dtor) { \
- int is_ref, refcount; \
- is_ref = (z)->is_ref; \
- refcount = (z)->refcount; \
- *(z) = *(zv); \
- if (copy) { \
- zval_copy_ctor(z); \
- } \
- if (dtor) { \
- if (!copy) { \
- ZVAL_NULL(zv); \
- } \
- zval_ptr_dtor(&zv); \
- } \
- (z)->is_ref = is_ref; \
- (z)->refcount = refcount; \
- }
-#endif
-#ifndef RETVAL_ZVAL
-#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
-#endif
-#ifndef RETURN_ZVAL
-#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
-#endif
-
#define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
#define PHP_RINIT_CALL(func) PHP_RINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
#define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)