cvs: pecl /http http.c http_functions.c http_request_api.c http_request_body_api.c http_request_object.c package2.xml php_http.h
php_http_request_body_api.h php_http_request_object.h /http/docs functions.html

From: Date: Fri, 24 Feb 2006 20:31:53 +0000
Subject: cvs: pecl /http http.c http_functions.c http_request_api.c http_request_body_api.c http_request_object.c package2.xml php_http.h
php_http_request_body_api.h php_http_request_object.h /http/docs functions.html
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-5259@lists.php.net to get a copy of this message
mike Fri Feb 24 20:31:53 2006 UTC Modified files: /pecl/http http.c http_functions.c http_request_api.c http_request_body_api.c http_request_object.c package2.xml php_http.h php_http_request_body_api.h php_http_request_object.h /pecl/http/docs functions.html Log: - add http_put_data() and HttpRequest::(set|get|add)PutData() - fix HttpRequest::addRawPostData() - properly initialize request body in http_(post|put)_*()

http://cvs.php.net/viewcvs.cgi/pecl/http/http.c?r1=1.160&r2=1.161&diff_format=u Index: pecl/http/http.c diff -u pecl/http/http.c:1.160 pecl/http/http.c:1.161 --- pecl/http/http.c:1.160 Mon Feb 20 15:59:37 2006 +++ pecl/http/http.c Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http.c,v 1.160 2006/02/20 15:59:37 mike Exp $ */ +/* $Id: http.c,v 1.161 2006/02/24 20:31:53 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_CURL @@ -102,6 +102,7 @@ PHP_FE(http_head, http_arg_pass_ref_3) PHP_FE(http_post_data, http_arg_pass_ref_4) PHP_FE(http_post_fields, http_arg_pass_ref_5) + PHP_FE(http_put_data, http_arg_pass_ref_4) PHP_FE(http_put_file, http_arg_pass_ref_4) PHP_FE(http_put_stream, http_arg_pass_ref_4) #endif http://cvs.php.net/viewcvs.cgi/pecl/http/http_functions.c?r1=1.123&r2=1.124&diff_format=u Index: pecl/http/http_functions.c diff -u pecl/http/http_functions.c:1.123 pecl/http/http_functions.c:1.124 --- pecl/http/http_functions.c:1.123 Mon Feb 20 16:06:21 2006 +++ pecl/http/http_functions.c Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_functions.c,v 1.123 2006/02/20 16:06:21 mike Exp $ */ +/* $Id: http_functions.c,v 1.124 2006/02/24 20:31:53 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_CURL @@ -1517,12 +1517,8 @@ RETVAL_FALSE; - body.type = HTTP_REQUEST_BODY_UPLOADFILE; - body.data = stream; - body.size = ssb.sb.st_size; - http_request_init_ex(&request, NULL, HTTP_PUT, URL); - request.body = &body; + request.body = http_request_body_init_ex(&body, HTTP_REQUEST_BODY_UPLOADFILE, stream, ssb.sb.st_size, 1); if (SUCCESS == http_request_prepare(&request, options?Z_ARRVAL_P(options):NULL)) { http_request_exec(&request); if (info) { @@ -1530,8 +1526,6 @@ } RETVAL_RESPONSE_OR_BODY(request); } - http_request_body_dtor(&body); - request.body = NULL; http_request_dtor(&request); } /* }}} */ @@ -1544,7 +1538,7 @@ * 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. + * Returns the HTTP response(s) as string on success, or FALSE on failure. */ PHP_FUNCTION(http_put_stream) { @@ -1572,12 +1566,49 @@ RETVAL_FALSE; - body.type = HTTP_REQUEST_BODY_UPLOADFILE; - body.data = stream; - body.size = ssb.sb.st_size; + http_request_init_ex(&request, NULL, HTTP_PUT, URL); + request.body = http_request_body_init_ex(&body, HTTP_REQUEST_BODY_UPLOADFILE, stream, ssb.sb.st_size, 0); + if (SUCCESS == http_request_prepare(&request, options?Z_ARRVAL_P(options):NULL)) { + http_request_exec(&request); + if (info) { + http_request_info(&request, Z_ARRVAL_P(info)); + } + RETVAL_RESPONSE_OR_BODY(request); + } + http_request_dtor(&request); +} +/* }}} */ - http_request_init_ex(&request, NULL, HTTP_POST, URL); - request.body = &body; +/* {{{ proto string http_put_data(string url, string data[, array options[, array &info]]) + * + * Performs an HTTP PUT request on the supplied url. + * + * Expects the second parameter to be a string containing the data to upload. + * 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_data) +{ + char *URL, *data; + int URL_len, data_len; + zval *options = NULL, *info = NULL; + http_request_body body; + http_request request; + + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|a/!z", &URL, &URL_len, &data, &data_len, &options, &info)) { + RETURN_FALSE; + } + + if (info) { + zval_dtor(info); + array_init(info); + } + + RETVAL_FALSE; + + http_request_init_ex(&request, NULL, HTTP_PUT, URL); + request.body = http_request_body_init_ex(&body, HTTP_REQUEST_BODY_CSTRING, data, data_len, 0); if (SUCCESS == http_request_prepare(&request, options?Z_ARRVAL_P(options):NULL)) { http_request_exec(&request); if (info) { @@ -1585,7 +1616,6 @@ } RETVAL_RESPONSE_OR_BODY(request); } - request.body = NULL; http_request_dtor(&request); } /* }}} */ http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_api.c?r1=1.119&r2=1.120&diff_format=u Index: pecl/http/http_request_api.c diff -u pecl/http/http_request_api.c:1.119 pecl/http/http_request_api.c:1.120 --- pecl/http/http_request_api.c:1.119 Fri Feb 17 16:35:05 2006 +++ pecl/http/http_request_api.c Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_request_api.c,v 1.119 2006/02/17 16:35:05 mike Exp $ */ +/* $Id: http_request_api.c,v 1.120 2006/02/24 20:31:53 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_CURL @@ -827,15 +827,17 @@ /* nothing */ break; - case HTTP_REQUEST_BODY_CSTRING: - HTTP_CURL_OPT(CURLOPT_POSTFIELDS, request->body->data); - HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, request->body->size); - break; - case HTTP_REQUEST_BODY_CURLPOST: HTTP_CURL_OPT(CURLOPT_HTTPPOST, (struct curl_httppost *) request->body->data); break; + case HTTP_REQUEST_BODY_CSTRING: + if (request->meth != HTTP_PUT) { + HTTP_CURL_OPT(CURLOPT_POSTFIELDS, request->body->data); + HTTP_CURL_OPT(CURLOPT_POSTFIELDSIZE, request->body->size); + break; + } + /* fallthrough, PUT/UPLOAD _needs_ READDATA */ case HTTP_REQUEST_BODY_UPLOADFILE: HTTP_CURL_OPT(CURLOPT_IOCTLDATA, request); HTTP_CURL_OPT(CURLOPT_READDATA, request); @@ -910,11 +912,28 @@ { http_request *request = (http_request *) ctx; TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); - - if (request->body == NULL || request->body->type != HTTP_REQUEST_BODY_UPLOADFILE) { - return 0; + + if (request->body) { + switch (request->body->type) + { + case HTTP_REQUEST_BODY_CSTRING: + { + size_t out = MIN(len * n, request->body->size - request->body->priv); + + if (out) { + memcpy(data, request->body->data + request->body->priv, out); + request->body->priv += out; + return out; + } + } + break; + + case HTTP_REQUEST_BODY_UPLOADFILE: + return php_stream_read((php_stream *) request->body->data, data, len * n); + break; + } } - return php_stream_read((php_stream *) request->body->data, data, len * n); + return 0; } /* }}} */ @@ -953,12 +972,24 @@ if (cmd != CURLIOCMD_RESTARTREAD) { return CURLIOE_UNKNOWNCMD; } - if ( request->body == NULL || - request->body->type != HTTP_REQUEST_BODY_UPLOADFILE || - SUCCESS != php_stream_rewind((php_stream *) request->body->data)) { - return CURLIOE_FAILRESTART; + + if (request->body) { + switch (request->body->type) + { + case HTTP_REQUEST_BODY_CSTRING: + request->body->priv = 0; + return CURLIOE_OK; + break; + + case HTTP_REQUEST_BODY_UPLOADFILE: + if (SUCCESS == php_stream_rewind((php_stream *) request->body->data)) { + return CURLIOE_OK; + } + break; + } } - return CURLIOE_OK; + + return CURLIOE_FAILRESTART; } /* }}} */ http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_body_api.c?r1=1.11&r2=1.12&diff_format=u Index: pecl/http/http_request_body_api.c diff -u pecl/http/http_request_body_api.c:1.11 pecl/http/http_request_body_api.c:1.12 --- pecl/http/http_request_body_api.c:1.11 Thu Jan 19 11:42:08 2006 +++ pecl/http/http_request_body_api.c Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_request_body_api.c,v 1.11 2006/01/19 11:42:08 mike Exp $ */ +/* $Id: http_request_body_api.c,v 1.12 2006/02/24 20:31:53 mike Exp $ */ #define HTTP_WANT_CURL #include "php_http.h" @@ -30,6 +30,7 @@ body->type = type; body->free = free; + body->priv = 0; body->data = data; body->size = size; http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_object.c?r1=1.116&r2=1.117&diff_format=u Index: pecl/http/http_request_object.c diff -u pecl/http/http_request_object.c:1.116 pecl/http/http_request_object.c:1.117 --- pecl/http/http_request_object.c:1.116 Wed Feb 22 17:58:44 2006 +++ pecl/http/http_request_object.c Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_request_object.c,v 1.116 2006/02/22 17:58:44 mike Exp $ */ +/* $Id: http_request_object.c,v 1.117 2006/02/24 20:31:53 mike Exp $ */ #define HTTP_WANT_CURL #include "php_http.h" @@ -130,6 +130,15 @@ HTTP_ARG_VAL(filename, 0) HTTP_END_ARGS; +HTTP_EMPTY_ARGS(getPutData); +HTTP_BEGIN_ARGS(setPutData, 0) + HTTP_ARG_VAL(put_data, 0) +HTTP_END_ARGS; + +HTTP_BEGIN_ARGS(addPutData, 1) + HTTP_ARG_VAL(put_data, 0) +HTTP_END_ARGS; + HTTP_EMPTY_ARGS(getResponseData); HTTP_BEGIN_ARGS(getResponseHeader, 0) HTTP_ARG_VAL(name, 0) @@ -261,6 +270,10 @@ HTTP_REQUEST_ME(setPutFile, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getPutFile, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(setPutData, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(getPutData, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(addPutData, ZEND_ACC_PUBLIC) + HTTP_REQUEST_ME(send, ZEND_ACC_PUBLIC) HTTP_REQUEST_ME(getResponseData, ZEND_ACC_PUBLIC) @@ -366,6 +379,7 @@ DCL_PROP(PRIVATE, string, rawPostData, ""); DCL_PROP(PRIVATE, string, queryData, ""); DCL_PROP(PRIVATE, string, putFile, ""); + DCL_PROP(PRIVATE, string, putData, ""); DCL_PROP_N(PRIVATE, history); DCL_PROP(PUBLIC, bool, recordHistory, 0); @@ -432,6 +446,35 @@ efree(o); } +#define http_request_object_check_request_content_type(t) _http_request_object_check_request_content_type((t) TSRMLS_CC) +static inline void _http_request_object_check_request_content_type(zval *this_ptr TSRMLS_DC) +{ + zval *ctype = GET_PROP(contentType); + + if (Z_STRLEN_P(ctype)) { + zval **headers, *opts = GET_PROP(options); + + if ( (Z_TYPE_P(opts) == IS_ARRAY) && + (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), "headers", sizeof("headers"), (void **) &headers)) && + (Z_TYPE_PP(headers) == IS_ARRAY)) { + zval **ct_header; + + /* only override if not already set */ + if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header))) { + add_assoc_stringl(*headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1); + } + } else { + zval *headers; + + MAKE_STD_ZVAL(headers); + array_init(headers); + add_assoc_stringl(headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1); + zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "addheaders", NULL, headers); + zval_ptr_dtor(&headers); + } + } +} + STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ptr TSRMLS_DC) { STATUS status = SUCCESS; @@ -449,13 +492,21 @@ case HTTP_PUT: { - php_stream_statbuf ssb; - php_stream *stream = php_stream_open_wrapper_ex(Z_STRVAL_P(GET_PROP(putFile)), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT); + zval *put_data = GET_PROP(putData); - if (stream && !php_stream_stat(stream, &ssb)) { - obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_UPLOADFILE, stream, ssb.sb.st_size, 1); + http_request_object_check_request_content_type(getThis()); + if (Z_STRLEN_P(put_data)) { + obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_CSTRING, + estrndup(Z_STRVAL_P(put_data), Z_STRLEN_P(put_data)), Z_STRLEN_P(put_data), 1); } else { - status = FAILURE; + php_stream_statbuf ssb; + php_stream *stream = php_stream_open_wrapper_ex(Z_STRVAL_P(GET_PROP(putFile)), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT); + + if (stream && !php_stream_stat(stream, &ssb)) { + obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_UPLOADFILE, stream, ssb.sb.st_size, 1); + } else { + status = FAILURE; + } } } break; @@ -467,34 +518,9 @@ zval *raw_data = GET_PROP(rawPostData); if (Z_STRLEN_P(raw_data)) { - zval *ctype = GET_PROP(contentType); - - if (Z_STRLEN_P(ctype)) { - zval **headers, *opts = GET_PROP(options); - - if ( (Z_TYPE_P(opts) == IS_ARRAY) && - (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), "headers", sizeof("headers"), (void **) &headers)) && - (Z_TYPE_PP(headers) == IS_ARRAY)) { - zval **ct_header; - - /* only override if not already set */ - if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header))) { - add_assoc_stringl(*headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1); - } - } else { - zval *headers; - - MAKE_STD_ZVAL(headers); - array_init(headers); - add_assoc_stringl(headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1); - zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "addheaders", NULL, headers); - zval_ptr_dtor(&headers); - } - } - + http_request_object_check_request_content_type(getThis()); obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_CSTRING, estrndup(Z_STRVAL_P(raw_data), Z_STRLEN_P(raw_data)), Z_STRLEN_P(raw_data), 1); - } else { zval *zfields = GET_PROP(postFields), *zfiles = GET_PROP(postFiles); HashTable *fields; @@ -1292,13 +1318,15 @@ } if (data_len) { - zval *data = zval_copy(IS_STRING, GET_PROP(rawPostData)); + zval *data = GET_PROP(rawPostData); - 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, raw_data, data_len); - SET_PROP(rawPostData, data); - zval_free(&data); + 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, raw_data, data_len); + } else { + UPD_STRL(putData, raw_data, data_len); + } } RETURN_TRUE; @@ -1458,6 +1486,88 @@ } /* }}} */ +/* {{{ 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) { + char *new_data; + size_t new_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); + } +} +/* }}} */ + /* {{{ proto array HttpRequest::getResponseData() * * Get all response data after the request has been sent. http://cvs.php.net/viewcvs.cgi/pecl/http/package2.xml?r1=1.68&r2=1.69&diff_format=u Index: pecl/http/package2.xml diff -u pecl/http/package2.xml:1.68 pecl/http/package2.xml:1.69 --- pecl/http/package2.xml:1.68 Thu Feb 23 12:10:31 2006 +++ pecl/http/package2.xml Fri Feb 24 20:31:53 2006 @@ -37,8 +37,8 @@ </lead> <date>2006-00-00</date> <version> - <release>0.24.1</release> - <api>0.24.0</api> + <release>0.25.0</release> + <api>0.25.0</api> </version> <stability> <release>beta</release> @@ -46,8 +46,10 @@ </stability> <license>BSD, revised</license> <notes><![CDATA[ -* Fixed bug #6861 - 5 digit ports get truncated -* Fixed bug with non-functional HttpRequest::setContentType() +* Fixed bug #6924 - Linking fails on Mac OSX +* Fixed HttpRequest::addRawPostData(). + ++ Added feature request http_put_data() and HttpRequest::(set|get|add)PutData(). ]]></notes> <contents> <dir name="/"> http://cvs.php.net/viewcvs.cgi/pecl/http/php_http.h?r1=1.126&r2=1.127&diff_format=u Index: pecl/http/php_http.h diff -u pecl/http/php_http.h:1.126 pecl/http/php_http.h:1.127 --- pecl/http/php_http.h:1.126 Tue Feb 21 22:43:17 2006 +++ pecl/http/php_http.h Fri Feb 24 20:31:53 2006 @@ -10,12 +10,12 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http.h,v 1.126 2006/02/21 22:43:17 mike Exp $ */ +/* $Id: php_http.h,v 1.127 2006/02/24 20:31:53 mike Exp $ */ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_VERSION "0.24.1" +#define PHP_EXT_HTTP_VERSION "0.25.0dev" #ifdef HAVE_CONFIG_H # include "config.h" @@ -178,6 +178,7 @@ PHP_FUNCTION(http_head); PHP_FUNCTION(http_post_data); PHP_FUNCTION(http_post_fields); +PHP_FUNCTION(http_put_data); PHP_FUNCTION(http_put_file); PHP_FUNCTION(http_put_stream); #endif /* HTTP_HAVE_CURL */ http://cvs.php.net/viewcvs.cgi/pecl/http/php_http_request_body_api.h?r1=1.7&r2=1.8&diff_format=u Index: pecl/http/php_http_request_body_api.h diff -u pecl/http/php_http_request_body_api.h:1.7 pecl/http/php_http_request_body_api.h:1.8 --- pecl/http/php_http_request_body_api.h:1.7 Sat Jan 7 17:22:58 2006 +++ pecl/http/php_http_request_body_api.h Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http_request_body_api.h,v 1.7 2006/01/07 17:22:58 mike Exp $ */ +/* $Id: php_http_request_body_api.h,v 1.8 2006/02/24 20:31:53 mike Exp $ */ #ifndef PHP_HTTP_REQUEST_BODY_API_H #define PHP_HTTP_REQUEST_BODY_API_H @@ -22,8 +22,9 @@ #define HTTP_REQUEST_BODY_CURLPOST 2 #define HTTP_REQUEST_BODY_UPLOADFILE 3 typedef struct { - uint type:31; + uint type:3; uint free:1; + uint priv:28; void *data; size_t size; } http_request_body; http://cvs.php.net/viewcvs.cgi/pecl/http/php_http_request_object.h?r1=1.33&r2=1.34&diff_format=u Index: pecl/http/php_http_request_object.h diff -u pecl/http/php_http_request_object.h:1.33 pecl/http/php_http_request_object.h:1.34 --- pecl/http/php_http_request_object.h:1.33 Tue Feb 14 09:29:54 2006 +++ pecl/http/php_http_request_object.h Fri Feb 24 20:31:53 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http_request_object.h,v 1.33 2006/02/14 09:29:54 mike Exp $ */ +/* $Id: php_http_request_object.h,v 1.34 2006/02/24 20:31:53 mike Exp $ */ #ifndef PHP_HTTP_REQUEST_OBJECT_H #define PHP_HTTP_REQUEST_OBJECT_H @@ -76,6 +76,9 @@ PHP_METHOD(HttpRequest, getPostFiles); PHP_METHOD(HttpRequest, setPutFile); PHP_METHOD(HttpRequest, getPutFile); +PHP_METHOD(HttpRequest, getPutData); +PHP_METHOD(HttpRequest, setPutData); +PHP_METHOD(HttpRequest, addPutData); PHP_METHOD(HttpRequest, send); PHP_METHOD(HttpRequest, getResponseData); PHP_METHOD(HttpRequest, getResponseHeader); http://cvs.php.net/viewcvs.cgi/pecl/http/docs/functions.html?r1=1.32&r2=1.33&diff_format=u Index: pecl/http/docs/functions.html diff -u pecl/http/docs/functions.html:1.32 pecl/http/docs/functions.html:1.33 --- pecl/http/docs/functions.html:1.32 Mon Feb 20 16:43:48 2006 +++ pecl/http/docs/functions.html Fri Feb 24 20:31:53 2006 @@ -386,7 +386,12 @@ <p>Expects the second parameter to be a resource referencing an already <br /> opened stream, from which the data to upload should be read.<br /> See http_get() for a full list of available options.</p> -<p>Returns the HTTP response(s) as string on success. or FALSE on failure.</p> +<p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p> +<h2 id="http_put_data">string http_put_data(string url, string data[, array options[, array &info]])</h2> +<p>Performs an HTTP PUT request on the supplied url.</p> +<p>Expects the second parameter to be a string containing the data to upload.<br /> +See http_get() for a full list of available options.</p> +<p>Returns the HTTP response(s) as string on success, or FALSE on failure.</p> <h2 id="http_request_method_register">int http_request_method_register(string method)</h2> <p>Register a custom request method.</p> <p>Expects a string parameter containing the request method name to register.</p> @@ -777,6 +782,22 @@ <h3 id="HttpRequest_getPutFile">string HttpRequest::getPutFile()</h3> <p>Get previously set put file.</p> <p>Returns a string containing the path to the currently set put file.</p> +<h3 id="HttpRequest_setPutData">bool HttpRequest::setPutData([string put_data])</h3> +<p>Set PUT data to send, overwriting previously set PUT data.<br /> +Affects only PUT requests.<br /> +Only either PUT data or PUT file can be used for each request.<br /> +PUT data has higher precedence and will be used even if a PUT<br /> +file is set. </p> +<p>Accepts a string as parameter containing the data to upload.</p> +<p>Returns TRUE on success, or FALSE on failure.</p> +<h3 id="HttpRequest_addPutData">bool HttpRequest::addPutData(string put_data)</h3> +<p>Add PUT data, leaving previously set PUT data unchanged.<br /> +Affects only PUT requests.</p> +<p>Expects a string as parameter containing the data to concatenate.</p> +<p>Returns TRUE on success, or FALSE on failure.</p> +<h3 id="HttpRequest_getPutData">string HttpRequest::getPutData()</h3> +<p>Get previously set PUT data.</p> +<p>Returns a string containing the currently set raw post data.</p> <h3 id="HttpRequest_getResponseData">array HttpRequest::getResponseData()</h3> <p>Get all response data after the request has been sent.</p> <p>Returns an associative array with the key "headers" containing an associative<br /> @@ -1171,6 +1192,8 @@ </li> <li><a href="#http_put_stream">http_put_stream</a> </li> +<li><a href="#http_put_data">http_put_data</a> +</li> <li><a href="#http_request_method_register">http_request_method_register</a> </li> <li><a href="#http_request_method_unregister">http_request_method_unregister</a> @@ -1295,6 +1318,9 @@ <li><a href="#HttpRequest_getPostFiles">HttpRequest::getPostFiles()</a></li> <li><a href="#HttpRequest_setPutFile">HttpRequest::setPutFile()</a></li> <li><a href="#HttpRequest_getPutFile">HttpRequest::getPutFile()</a></li> +<li><a href="#HttpRequest_setPutData">HttpRequest::setPutData()</a></li> +<li><a href="#HttpRequest_addPutData">HttpRequest::addPutData()</a></li> +<li><a href="#HttpRequest_getPutData">HttpRequest::getPutData()</a></li> <li><a href="#HttpRequest_getResponseData">HttpRequest::getResponseData()</a></li> <li><a href="#HttpRequest_getResponseHeader">HttpRequest::getResponseHeader()</a></li> <li><a href="#HttpRequest_getResponseCookies">HttpRequest::getResponseCookies()</a></li> @@ -1369,7 +1395,7 @@ </li> </ul> </div> - <p><b>Generated at: Mon, 20 Feb 2006 17:41:32 +0100</b></p> + <p><b>Generated at: Fri, 24 Feb 2006 21:29:29 +0100</b></p> </body> </html>
« previous php.pecl.cvs (#5259) next »