HTTP_END_ARGS;
HTTP_EMPTY_ARGS(getBody, 0);
+HTTP_BEGIN_ARGS(setBody, 0, 1)
+ HTTP_ARG_VAL(body)
+HTTP_END_ARGS;
+
HTTP_EMPTY_ARGS(getHeaders, 0);
HTTP_BEGIN_ARGS(setHeaders, 0, 1)
HTTP_ARG_VAL(headers, 0)
zend_function_entry http_message_object_fe[] = {
HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
HTTP_MESSAGE_ME(getBody, ZEND_ACC_PUBLIC)
+ HTTP_MESSAGE_ME(setBody, ZEND_ACC_PUBLIC)
HTTP_MESSAGE_ME(getHeaders, ZEND_ACC_PUBLIC)
HTTP_MESSAGE_ME(setHeaders, ZEND_ACC_PUBLIC)
HTTP_MESSAGE_ME(addHeaders, ZEND_ACC_PUBLIC)
}
/* }}} */
+/* {{{ proto void HttpMessage::setBody(string body)
+ *
+ * Set the body of the HttpMessage.
+ * NOTE: Don't forget to update any headers accordingly.
+ */
+PHP_METHOD(HttpMessage, setBody)
+{
+ char *body;
+ int len;
+ getObject(http_message_object, obj);
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &body, &len)) {
+ phpstr_dtor(PHPSTR(obj->message));
+ phpstr_from_string_ex(PHPSTR(obj->message), body, len);
+ }
+}
+/* }}} */
+
/* {{{ proto array HttpMessage::getHeaders()
*
* Get Message Headers.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
-<!-- $Revision: 1.41 $ -->
+<!-- $Revision: 1.42 $ -->
<package version="1.0">
<name>pecl_http</name>
<summary>Extended HTTP support</summary>
<state>beta</state>
<notes><![CDATA[
+ Added missing support for raw post data in HttpRequest
++ Added missing HttpMessage::setBody()
]]>
</notes>
</release>
PHP_METHOD(HttpMessage, __construct);
PHP_METHOD(HttpMessage, getBody);
+PHP_METHOD(HttpMessage, setBody);
PHP_METHOD(HttpMessage, getHeaders);
PHP_METHOD(HttpMessage, setHeaders);
PHP_METHOD(HttpMessage, addHeaders);