+/* {{{ proto bool HttpRequest::setPutData([string put_data])
+ *
+ * Set PUT data to send, overwriting previously set PUT data.
+ * Affects only PUT requests.
+ * Only either PUT data or PUT file can be used for each request.
+ * PUT data has higher precedence and will be used even if a PUT
+ * file is set.
+ *
+ * Accepts a string as parameter containing the data to upload.
+ *
+ * Returns TRUE on success, or FALSE on failure.
+ */
+PHP_METHOD(HttpRequest, setPutData)
+{
+ char *put_data = NULL;
+ int data_len = 0;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &put_data, &data_len)) {
+ RETURN_FALSE;
+ }
+
+ if (!put_data) {
+ put_data = "";
+ }
+
+ UPD_STRL(putData, put_data, data_len);
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool HttpRequest::addPutData(string put_data)
+ *
+ * Add PUT data, leaving previously set PUT data unchanged.
+ * Affects only PUT requests.
+ *
+ * Expects a string as parameter containing the data to concatenate.
+ *
+ * Returns TRUE on success, or FALSE on failure.
+ */
+PHP_METHOD(HttpRequest, addPutData)
+{
+ char *put_data;
+ int data_len;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &put_data, &data_len)) {
+ RETURN_FALSE;
+ }
+
+ if (data_len) {
+ zval *data = GET_PROP(putData);
+
+ if (Z_STRLEN_P(data)) {
+ Z_STRVAL_P(data) = erealloc(Z_STRVAL_P(data), (Z_STRLEN_P(data) += data_len) + 1);
+ Z_STRVAL_P(data)[Z_STRLEN_P(data)] = '\0';
+ memcpy(Z_STRVAL_P(data) + Z_STRLEN_P(data) - data_len, put_data, data_len);
+ } else {
+ UPD_STRL(putData, put_data, data_len);
+ }
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto string HttpRequest::getPutData()
+ *
+ * Get previously set PUT data.
+ *
+ * Returns a string containing the currently set raw post data.
+ */
+PHP_METHOD(HttpRequest, getPutData)
+{
+ NO_ARGS;
+
+ IF_RETVAL_USED {
+ RETURN_PROP(putData);