[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] cvs: pecl /http http_functions.c http_request_api.c http_request_object.c package2.xml
From: "Michael Wallner" <mike () php ! net>
Date: 2006-02-27 16:55:14
Message-ID: cvsmike1141059314 () cvsserver
[Download RAW message or body]
mike Mon Feb 27 16:55:14 2006 UTC
Modified files:
/pecl/http http_functions.c http_request_api.c
http_request_object.c package2.xml
Log:
- add 'range' request option
- add 'proxytype' request option
- add proxy type constants
http://cvs.php.net/viewcvs.cgi/pecl/http/http_functions.c?r1=1.124&r2=1.125&diff_format=u
Index: pecl/http/http_functions.c
diff -u pecl/http/http_functions.c:1.124 pecl/http/http_functions.c:1.125
--- pecl/http/http_functions.c:1.124 Fri Feb 24 20:31:53 2006
+++ pecl/http/http_functions.c Mon Feb 27 16:55:13 2006
@@ -10,7 +10,7 @@
+--------------------------------------------------------------------+
*/
-/* $Id: http_functions.c,v 1.124 2006/02/24 20:31:53 mike Exp $ */
+/* $Id: http_functions.c,v 1.125 2006/02/27 16:55:13 mike Exp $ */
#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
@@ -1230,6 +1230,7 @@
* redirects to a different host
* - proxyhost: string, proxy host in "host[:port]" format
* - proxyport: int, use another proxy port as specified in proxyhost
+ * - proxytype: int, HTTP_PROXY_HTTP, SOCKS4 or SOCKS5
* - proxyauth: string, proxy credentials in "user:pass" format
* - proxyauthtype: int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM
* - httpauth: string, http credentials in "user:pass" format
@@ -1249,6 +1250,9 @@
* - cookiesession: bool, accept (true) or reset (false) sessioncookies
* - resume: int, byte offset to start the download from;
* if the server supports ranges
+ * - range: array, array of arrays, each containing two integers,
+ * specifying the ranges to download if server support is
+ * given; only recognized if the resume option is empty
* - maxfilesize: int, maximum file size that should be downloaded;
* has no effect, if the size of the requested entity is not \
known
* - lastmodified: int, timestamp for If-(Un)Modified-Since header
http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_api.c?r1=1.120&r2=1.121&diff_format=u
Index: pecl/http/http_request_api.c
diff -u pecl/http/http_request_api.c:1.120 pecl/http/http_request_api.c:1.121
--- pecl/http/http_request_api.c:1.120 Fri Feb 24 20:31:53 2006
+++ pecl/http/http_request_api.c Mon Feb 27 16:55:13 2006
@@ -10,7 +10,7 @@
+--------------------------------------------------------------------+
*/
-/* $Id: http_request_api.c,v 1.120 2006/02/24 20:31:53 mike Exp $ */
+/* $Id: http_request_api.c,v 1.121 2006/02/27 16:55:13 mike Exp $ */
#define HTTP_WANT_SAPI
#define HTTP_WANT_CURL
@@ -147,6 +147,11 @@
HTTP_LONG_CONSTANT("HTTP_VERSION_1_0", CURL_HTTP_VERSION_1_0);
HTTP_LONG_CONSTANT("HTTP_VERSION_1_1", CURL_HTTP_VERSION_1_1);
+#if HTTP_CURL_VERSION(7,15,2)
+ HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4", CURLPROXY_SOCKS4);
+#endif
+ HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5", CURLPROXY_SOCKS5);
+ HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP", CURLPROXY_HTTP);
return SUCCESS;
}
/* }}} */
@@ -425,6 +430,7 @@
HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1);
HTTP_CURL_OPT(CURLOPT_PROXY, NULL);
HTTP_CURL_OPT(CURLOPT_PROXYPORT, 0);
+ HTTP_CURL_OPT(CURLOPT_PROXYTYPE, 0);
HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, NULL);
HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0);
HTTP_CURL_OPT(CURLOPT_INTERFACE, NULL);
@@ -447,6 +453,7 @@
#endif
HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL);
HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL);
+ HTTP_CURL_OPT(CURLOPT_RANGE, NULL);
HTTP_CURL_OPT(CURLOPT_RESUME_FROM, 0);
HTTP_CURL_OPT(CURLOPT_MAXFILESIZE, 0);
HTTP_CURL_OPT(CURLOPT_TIMECONDITION, 0);
@@ -526,7 +533,10 @@
if (Z_STRLEN_P(zoption)) {
HTTP_CURL_OPT(CURLOPT_PROXY, Z_STRVAL_P(zoption));
}
-
+ /* type */
+ if ((zoption = http_request_option(request, options, "proxytype", IS_LONG))) {
+ HTTP_CURL_OPT(CURLOPT_PROXYTYPE, Z_LVAL_P(zoption));
+ }
/* port */
if ((zoption = http_request_option(request, options, "proxyport", IS_LONG))) {
HTTP_CURL_OPT(CURLOPT_PROXYPORT, Z_LVAL_P(zoption));
@@ -609,6 +619,46 @@
range_req = 1;
HTTP_CURL_OPT(CURLOPT_RESUME_FROM, Z_LVAL_P(zoption));
}
+ /* or range of kind array(array(0,499), array(100,1499)) */
+ else if ((zoption = http_request_option(request, options, "range", IS_ARRAY)) && \
zend_hash_num_elements(Z_ARRVAL_P(zoption))) { + HashPosition pos1, pos2;
+ zval **rr, **rb, **re;
+ phpstr rs;
+
+ phpstr_init(&rs);
+ FOREACH_VAL(pos1, zoption, rr) {
+ if (Z_TYPE_PP(rr) == IS_ARRAY) {
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(rr), &pos2);
+ if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void **) &rb, \
&pos2)) { + zend_hash_move_forward_ex(Z_ARRVAL_PP(rr), &pos2);
+ if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(rr), (void **) &re, \
&pos2)) { + if ( ((Z_TYPE_PP(rb) == IS_LONG) || ((Z_TYPE_PP(rb) == IS_STRING) && \
is_numeric_string(Z_STRVAL_PP(rb), Z_STRLEN_PP(rb), NULL, NULL, 1))) && \
+ ((Z_TYPE_PP(re) == IS_LONG) || ((Z_TYPE_PP(re) == IS_STRING) && \
is_numeric_string(Z_STRVAL_PP(re), Z_STRLEN_PP(re), NULL, NULL, 1)))) { + zval \
*rbl = zval_copy(IS_LONG, *rb), *rel = zval_copy(IS_LONG, *re); +
+ if ((Z_LVAL_P(rbl) >= 0) && (Z_LVAL_P(rel) >= 0)) {
+ phpstr_appendf(&rs, "%ld-%ld,", Z_LVAL_P(rbl), Z_LVAL_P(rel));
+ }
+ zval_free(&rbl);
+ zval_free(&rel);
+ }
+ }
+ }
+ }
+ }
+
+ if (PHPSTR_LEN(&rs)) {
+ zval *cached_range;
+
+ /* ditch last comma */
+ PHPSTR_VAL(&rs)[PHPSTR_LEN(&rs)-- -1] = '\0';
+ /* cache string */
+ MAKE_STD_ZVAL(cached_range);
+ ZVAL_STRINGL(cached_range, PHPSTR_VAL(&rs), PHPSTR_LEN(&rs), 0);
+ HTTP_CURL_OPT(CURLOPT_RANGE, Z_STRVAL_P(http_request_option_cache(request, \
"range", cached_range))); + zval_ptr_dtor(&cached_range);
+ }
+ }
/* additional headers, array('name' => 'value') */
if (request->_cache.headers) {
http://cvs.php.net/viewcvs.cgi/pecl/http/http_request_object.c?r1=1.118&r2=1.119&diff_format=u
Index: pecl/http/http_request_object.c
diff -u pecl/http/http_request_object.c:1.118 pecl/http/http_request_object.c:1.119
--- pecl/http/http_request_object.c:1.118 Sat Feb 25 16:16:53 2006
+++ pecl/http/http_request_object.c Mon Feb 27 16:55:13 2006
@@ -10,7 +10,7 @@
+--------------------------------------------------------------------+
*/
-/* $Id: http_request_object.c,v 1.118 2006/02/25 16:16:53 mike Exp $ */
+/* $Id: http_request_object.c,v 1.119 2006/02/27 16:55:13 mike Exp $ */
#define HTTP_WANT_CURL
#include "php_http.h"
@@ -419,7 +419,9 @@
/* WebDAV Access Control - RFC 3744 */
DCL_CONST(long, "METH_ACL", HTTP_ACL);
- /* cURL HTTP protocol versions */
+ /*
+ * HTTP Protocol Version Constants
+ */
DCL_CONST(long, "VERSION_1_0", CURL_HTTP_VERSION_1_0);
DCL_CONST(long, "VERSION_1_1", CURL_HTTP_VERSION_1_1);
DCL_CONST(long, "VERSION_NONE", CURL_HTTP_VERSION_NONE);
@@ -431,6 +433,15 @@
DCL_CONST(long, "AUTH_DIGEST", CURLAUTH_DIGEST);
DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM);
DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY);
+
+ /*
+ * Proxy Type Constants
+ */
+# if HTTP_CURL_VERSION(7,15,2)
+ DCL_CONST(long, "PROXY_SOCKS4", CURLPROXY_SOCKS4);
+# endif
+ DCL_CONST(long, "PROXY_SOCKS5", CURLPROXY_SOCKS5);
+ DCL_CONST(long, "PROXY_HTTP", CURLPROXY_HTTP);
#endif /* WONKY */
}
http://cvs.php.net/viewcvs.cgi/pecl/http/package2.xml?r1=1.70&r2=1.71&diff_format=u
Index: pecl/http/package2.xml
diff -u pecl/http/package2.xml:1.70 pecl/http/package2.xml:1.71
--- pecl/http/package2.xml:1.70 Fri Feb 24 20:39:14 2006
+++ pecl/http/package2.xml Mon Feb 27 16:55:13 2006
@@ -46,10 +46,13 @@
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-* Fixed bug #6924 - Linking fails on Mac OSX
+* Fixed bug #6924 (Linking fails on Mac OSX).
* Fixed HttpRequest::addRawPostData().
+ Added feature request http_put_data() and HttpRequest::(set|get|add)PutData().
++ Added 'range' request option.
++ Added 'proxytype' request option.
++ Added HTTP_PROXY_HTTP, HTTP_PROXY_SOCKS4, HTTP_PROXY_SOCKS5 constants.
]]></notes>
<contents>
<dir name="/">
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic