+ if (info) {
+ zval_dtor(info);
+ array_init(info);
+ }
+
+ body.type = HTTP_REQUEST_BODY_UPLOADFILE;
+ body.data = stream;
+ body.size = ssb.sb.st_size;
+
+ phpstr_init_ex(&response, HTTP_CURLBUF_SIZE, 0);
+ if (SUCCESS == http_put(URL, &body, options ? Z_ARRVAL_P(options) : NULL, info ? Z_ARRVAL_P(info) : NULL, &response)) {
+ RETVAL_PHPSTR_VAL(&response);
+ } else {
+ RETVAL_FALSE;
+ }
+ http_request_body_dtor(&body);
+}
+/* }}} */
+
+/* {{{ proto string http_put_stream(string url, resource stream[, array options[, array &info]])
+ *
+ * Performs an HTTP PUT request on the supplied url.
+ *
+ * Expects the second parameter to be a resource referencing an already
+ * opened stream, from which the data to upload should be read.
+ * See http_get() for a full list of available options.
+ *
+ * Returns the HTTP response(s) as string on success. or FALSE on failure.
+ */
+PHP_FUNCTION(http_put_stream)
+{
+ zval *resource, *options = NULL, *info = NULL;
+ char *URL;
+ int URL_len;
+ phpstr response;
+ php_stream *stream;
+ php_stream_statbuf ssb;
+ http_request_body body;
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sr|a/!z", &URL, &URL_len, &resource, &options, &info)) {