+/* {{{ proto bool HTTPi_Request::addPostData(array post_data)
+ *
+ */
+PHP_METHOD(HTTPi_Request, addPostData)
+{
+ zval *post, *post_data;
+ getObject(httpi_request_object, obj);
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &post_data)) {
+ RETURN_FALSE;
+ }
+
+ post = GET_PROP(obj, postData);
+ array_merge(post_data, post);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool HTTPi_Request::setPostData(array post_data)
+ *
+ */
+PHP_METHOD(HTTPi_Request, setPostData)
+{
+ zval *post, *post_data;
+ getObject(httpi_request_object, obj);
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &post_data)) {
+ RETURN_FALSE;
+ }
+
+ post = GET_PROP(obj, postData);
+ zend_hash_clean(Z_ARRVAL_P(post));
+ array_copy(post_data, post);
+
+ RETURN_TRUE;
+}
+/* }}}*/
+
+/* {{{ proto array HTTPi_Request::getPostData()
+ *
+ */
+PHP_METHOD(HTTPi_Request, getPostData)
+{
+ zval *post_data;
+ getObject(httpi_request_object, obj);
+
+ NO_ARGS;
+
+ post_data = GET_PROP(obj, postData);
+ array_init(return_value);
+ array_copy(post_data, return_value);
+}
+/* }}} */
+
+/* {{{ proto void HTTPi_Request::unsetPostData()
+ *
+ */
+PHP_METHOD(HTTPi_Request, unsetPostData)
+{
+ zval *post_data;
+ getObject(httpi_request_object, obj);
+
+ NO_ARGS;
+
+ post_data = GET_PROP(obj, postData);
+ zend_hash_clean(Z_ARRVAL_P(post_data));
+}
+/* }}} */
+
+/* {{{ proto bool HTTPi_Request::addPostFile(string name, string file[, string content_type = "application/x-octetstream"])
+ *
+ */
+PHP_METHOD(HTTPi_Request, addPostFile)
+{
+ zval *files, *entry;
+ char *name, *file, *type = NULL;
+ int name_len, file_len, type_len = 0;
+ getObject(httpi_request_object, obj);
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s", &name, &name_len, &file, &file_len, &type, &type_len)) {
+ RETURN_FALSE;
+ }
+
+ if (type_len) {
+ if (!strchr(type, '/')) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Content-Type '%s' doesn't seem to contain a primary and a secondary part", type);
+ RETURN_FALSE;
+ }
+ } else {
+ type = "application/x-octetstream";
+ type_len = sizeof("application/x-octetstream") - 1;
+ }
+
+ MAKE_STD_ZVAL(entry);
+ array_init(entry);
+
+ add_assoc_stringl(entry, "name", name, name_len, 1);
+ add_assoc_stringl(entry, "type", type, type_len, 1);
+ add_assoc_stringl(entry, "file", file, file_len, 1);
+
+ files = GET_PROP(obj, postFiles);
+ add_next_index_zval(files, entry);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto array HTTPi_Request::getPostFiles()
+ *
+ */
+PHP_METHOD(HTTPi_Request, getPostFiles)
+{
+ zval *files;
+ getObject(httpi_request_object, obj);
+
+ NO_ARGS;
+
+ files = GET_PROP(obj, postFiles);
+
+ array_init(return_value);
+ array_copy(files, return_value);
+}
+/* }}} */
+
+/* {{{ proto void HTTPi_Request::unsetPostFiles()
+ *
+ */
+PHP_METHOD(HTTPi_Request, unsetPostFiles)
+{
+ zval *files;
+ getObject(httpi_request_object, obj);
+
+ NO_ARGS;
+
+ files = GET_PROP(obj, postFiles);
+ zend_hash_clean(Z_ARRVAL_P(files));
+}
+/* }}} */
+