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

From: Date: Fri, 17 Feb 2006 16:35:05 +0000
Subject: cvs: pecl /http http_functions.c http_request_api.c package2.xml php_http.h /http/docs functions.html
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-5199@lists.php.net to get a copy of this message
mike Fri Feb 17 16:35:05 2006 UTC Modified files: /pecl/http http_functions.c http_request_api.c package2.xml php_http.h /pecl/http/docs functions.html Log: - add portrange request option http://cvs.php.net/viewcvs.cgi/pecl/http/http_functions.c?r1=1.120&r2=1.121&diff_format=u Index: pecl/http/http_functions.c diff -u pecl/http/http_functions.c:1.120 pecl/http/http_functions.c:1.121 --- pecl/http/http_functions.c:1.120 Tue Feb 14 14:24:17 2006 +++ pecl/http/http_functions.c Fri Feb 17 16:35:05 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_functions.c,v 1.120 2006/02/14 14:24:17 mike Exp $ */ +/* $Id: http_functions.c,v 1.121 2006/02/17 16:35:05 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_CURL @@ -1246,6 +1246,7 @@ * - encodecookies: bool, whether to urlencode the cookies (default: true) * - resetcookies: bool, wheter to reset the cookies * - cookiestore: string, path to a file where cookies are/will be stored + * - cookiesession: bool, accept (true) or reset (false) sessioncookies * - resume: int, byte offset to start the download from; * if the server supports ranges * - maxfilesize: int, maximum file size that should be downloaded; @@ -1255,6 +1256,8 @@ * - timeout: int, seconds the request may take * - connecttimeout: int, seconds the connect may take * - onprogress: mixed, progress callback + * - interface: string, outgoing network interface (ifname, ip or hostname) + * - portrange: array, 2 integers specifying outgoing portrange to try * - ssl: array, with the following options: * cert: string, path to certificate * certtype: string, type of certificate http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_api.c?r1=1.118&r2=1.119&diff_format=u Index: pecl/http/http_request_api.c diff -u pecl/http/http_request_api.c:1.118 pecl/http/http_request_api.c:1.119 --- pecl/http/http_request_api.c:1.118 Tue Feb 14 14:24:17 2006 +++ pecl/http/http_request_api.c Fri Feb 17 16:35:05 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: http_request_api.c,v 1.118 2006/02/14 14:24:17 mike Exp $ */ +/* $Id: http_request_api.c,v 1.119 2006/02/17 16:35:05 mike Exp $ */ #define HTTP_WANT_SAPI #define HTTP_WANT_CURL @@ -429,6 +429,10 @@ HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0); HTTP_CURL_OPT(CURLOPT_INTERFACE, NULL); HTTP_CURL_OPT(CURLOPT_PORT, 0); +#if HTTP_CURL_VERSION(7,15,2) + HTTP_CURL_OPT(CURLOPT_LOCALPORT, 0); + HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, 0); +#endif HTTP_CURL_OPT(CURLOPT_USERPWD, NULL); HTTP_CURL_OPT(CURLOPT_HTTPAUTH, 0); HTTP_CURL_OPT(CURLOPT_ENCODING, NULL); @@ -438,7 +442,7 @@ HTTP_CURL_OPT(CURLOPT_USERAGENT, "PECL::HTTP/" PHP_EXT_HTTP_VERSION " (PHP/" PHP_VERSION ")"); HTTP_CURL_OPT(CURLOPT_HTTPHEADER, NULL); HTTP_CURL_OPT(CURLOPT_COOKIE, NULL); -#if LIBCURL_VERSION_NUM >= 0x070e01 +#if HTTP_CURL_VERSION(7,14,1) HTTP_CURL_OPT(CURLOPT_COOKIELIST, NULL); #endif HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL); @@ -540,6 +544,27 @@ /* outgoing interface */ if ((zoption = http_request_option(request, options, "interface", IS_STRING))) { HTTP_CURL_OPT(CURLOPT_INTERFACE, Z_STRVAL_P(zoption)); + +#if HTTP_CURL_VERSION(7,15,2) + if ((zoption = http_request_option(request, options, "portrange", IS_ARRAY))) { + zval *prs, *pre; + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(zoption)); + if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void **) &prs)) { + zend_hash_move_forward(Z_ARRVAL_P(zoption)); + if (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(zoption), (void **) &pre)) { + zval *prs_cpy = zval_copy(IS_LONG, *prs), *pre_cpy = zval_copy(IS_LONG, *pre); + + if (Z_LVAL_P(prs_cpy) && Z_LVAL_P(pre_cpy)) { + HTTP_CURL_OPT(CURLOPT_LOCALPORT, MIN(Z_LVAL_P(prs_cpy), Z_LVAL_P(pre_cpy))); + HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, ABS(Z_LVAL_P(prs_cpy)-Z_LVAL_P(pre_cpy))+1L); + } + zval_free(&prs_cpy); + zval_free(&pre_cpy); + } + } + } +#endif } /* another port */ @@ -660,7 +685,6 @@ } } else { HashPosition pos; - zval *cookie_val = NULL; char *cookie_key = NULL; ulong cookie_idx; @@ -686,7 +710,7 @@ } } -#if LIBCURL_VERSION_NUM >= 0x070e01 +#if HTTP_CURL_VERSION(7,14,1) /* reset cookies */ if ((zoption = http_request_option(request, options, "resetcookies", IS_BOOL)) && Z_LVAL_P(zoption)) { HTTP_CURL_OPT(CURLOPT_COOKIELIST, "ALL"); @@ -873,7 +897,7 @@ HTTP_CURL_INFO(CURLINFO_HTTPAUTH_AVAIL); HTTP_CURL_INFO(CURLINFO_PROXYAUTH_AVAIL); HTTP_CURL_INFO(CURLINFO_NUM_CONNECTS); -#if LIBCURL_VERSION_NUM >= 0x070e01 +#if HTTP_CURL_VERSION(7,14,1) HTTP_CURL_INFO_EX(CURLINFO_COOKIELIST, "cookies"); #endif HTTP_CURL_INFO(CURLINFO_OS_ERRNO); http://cvs.php.net/viewcvs.cgi/pecl/http/package2.xml?r1=1.64&r2=1.65&diff_format=u Index: pecl/http/package2.xml diff -u pecl/http/package2.xml:1.64 pecl/http/package2.xml:1.65 --- pecl/http/package2.xml:1.64 Fri Feb 17 09:28:37 2006 +++ pecl/http/package2.xml Fri Feb 17 16:35:05 2006 @@ -47,6 +47,7 @@ <license>BSD, revised</license> <notes><![CDATA[ + Added If-Range header recognition. ++ Added "portrange" request option. * Fixed bug #6804 - configure does not recognize --without-http-zlib-compression. * Fixed cases where 412 Precondition failed should be sent. http://cvs.php.net/viewcvs.cgi/pecl/http/php_http.h?r1=1.123&r2=1.124&diff_format=u Index: pecl/http/php_http.h diff -u pecl/http/php_http.h:1.123 pecl/http/php_http.h:1.124 --- pecl/http/php_http.h:1.123 Thu Feb 16 17:49:53 2006 +++ pecl/http/php_http.h Fri Feb 17 16:35:05 2006 @@ -10,7 +10,7 @@ +--------------------------------------------------------------------+ */ -/* $Id: php_http.h,v 1.123 2006/02/16 17:49:53 mike Exp $ */ +/* $Id: php_http.h,v 1.124 2006/02/17 16:35:05 mike Exp $ */ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H @@ -59,6 +59,7 @@ # define CURL_STATICLIB # endif # include <curl/curl.h> +# define HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z))) #endif #if defined(HTTP_WANT_MAGIC) && defined(HTTP_HAVE_MAGIC) http://cvs.php.net/viewcvs.cgi/pecl/http/docs/functions.html?r1=1.30&r2=1.31&diff_format=u Index: pecl/http/docs/functions.html diff -u pecl/http/docs/functions.html:1.30 pecl/http/docs/functions.html:1.31 --- pecl/http/docs/functions.html:1.30 Wed Feb 15 07:44:31 2006 +++ pecl/http/docs/functions.html Fri Feb 17 16:35:05 2006 @@ -326,6 +326,7 @@ - encodecookies: bool, whether to urlencode the cookies (default: true)<br /> - resetcookies: bool, wheter to reset the cookies<br /> - cookiestore: string, path to a file where cookies are/will be stored<br /> + - cookiesession: bool, accept (true) or reset (false) sessioncookies<br /> - resume: int, byte offset to start the download from;<br /> if the server supports ranges<br /> - maxfilesize: int, maximum file size that should be downloaded;<br /> @@ -335,6 +336,8 @@ - timeout: int, seconds the request may take<br /> - connecttimeout: int, seconds the connect may take<br /> - onprogress: mixed, progress callback<br /> + - interface: string, outgoing network interface (ifname, ip or hostname)<br /> + - portrange: array, 2 integers specifying outgoing portrange to try<br /> - ssl: array, with the following options:<br /> cert: string, path to certificate<br /> certtype: string, type of certificate<br /> @@ -1355,7 +1358,7 @@ </li> </ul> </div> - <p><b>Generated at: Wed, 15 Feb 2006 08:40:01 +0100</b></p> + <p><b>Generated at: Fri, 17 Feb 2006 17:34:44 +0100</b></p> </body> </html>

« previous php.pecl.cvs (#5199) next »