From: Michael Wallner Date: Wed, 22 Jul 2009 14:37:55 +0000 (+0000) Subject: * Added request options: X-Git-Tag: RELEASE_1_7_0b2~23 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b1ace11a9604ffcc496d32827aa66a2ba99db5ff;p=m6w6%2Fext-http * Added request options: - proxytunnel: enable tunelling through the HTTP proxy - noproxy: comma separatet list of hosts (* means all hosts) not to use a proxy for (libcurl >= 7.19.4) * Added authtype request option constant: - HTTP_AUTH_DIGEST_IE * Added proxytype request option constant: - HTTP_PROXY_HTTP_1_0 * Added request info member: - condition_unmet (libcurl >= 7.19.4) --- diff --git a/KnownIssues.txt b/KnownIssues.txt index ca7e2cc..2453f27 100644 --- a/KnownIssues.txt +++ b/KnownIssues.txt @@ -18,3 +18,14 @@ Internals: to not check for zlib header bytes. This is not preventable AFAICS. LFS dependant parts of libcurl are left out because of off_t, respectively off64_t confusion. + Persistent handles and "cookiestore" request option do interfere, + as libcurl safes the cookies to the file on curl_easy_destroy(), + cookies are not safed until the CURL handle will be recycled. + Thus one would either need to + * run PHP with http.persistent.handles.limit = 0 + * call http_persistent_handles_clean() every request + * call $HttpRequest->flushCookies(), which is available + since libcurl v7.17.1 and does not work with the + procedural API + Anyway, none of these options is really perfect. + diff --git a/http_request_api.c b/http_request_api.c index 4ebbc2f..adc3a56 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -161,6 +161,9 @@ PHP_MINIT_FUNCTION(http_request) HTTP_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC); HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST); +#if HTTP_CURL_VERSION(7,19,3) + HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST_IE", CURLAUTH_DIGEST_IE); +#endif HTTP_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM); HTTP_LONG_CONSTANT("HTTP_AUTH_GSSNEG", CURLAUTH_GSSNEGOTIATE); HTTP_LONG_CONSTANT("HTTP_AUTH_ANY", CURLAUTH_ANY); @@ -188,6 +191,9 @@ PHP_MINIT_FUNCTION(http_request) #endif HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS5", CURLPROXY_SOCKS5); HTTP_LONG_CONSTANT("HTTP_PROXY_HTTP", CURLPROXY_HTTP); +#if HTTP_CURL_VERSION(7,19,4) + TTP_LONG_CONSTANT("HTTP_PROXY_HTTP_1_0", CURLPROXY_HTTP_1_0); +#endif return SUCCESS; } /* }}} */ @@ -459,11 +465,15 @@ PHP_HTTP_API void _http_request_defaults(http_request *request) HTTP_CURL_OPT(CURLOPT_PROGRESSFUNCTION, NULL); HTTP_CURL_OPT(CURLOPT_URL, NULL); HTTP_CURL_OPT(CURLOPT_NOPROGRESS, 1L); +#if HTTP_CURL_VERSION(7,19,4) + HTTP_CURL_OPT(CURLOPT_NOPROXY, NULL); +#endif HTTP_CURL_OPT(CURLOPT_PROXY, NULL); HTTP_CURL_OPT(CURLOPT_PROXYPORT, 0L); HTTP_CURL_OPT(CURLOPT_PROXYTYPE, 0L); HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, NULL); HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0L); + HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 0L); HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, 60L); HTTP_CURL_OPT(CURLOPT_IPRESOLVE, 0); HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, 0L); @@ -620,7 +630,16 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti if ((zoption = http_request_option(request, options, "proxyauthtype", IS_LONG))) { HTTP_CURL_OPT(CURLOPT_PROXYAUTH, Z_LVAL_P(zoption)); } + /* tunnel */ + if ((zoption = http_request_option(request, options, "proxytunnel", IS_BOOL)) && Z_BVAL_P(zoption)) { + HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 1L); + } + } +#if HTTP_CURL_VERSION(7,19,4) + if ((zoption = http_request_option, request, options, "noproxy", IS_STRING))) { + HTTP_CURL_OPT(CURLOPT_NOPROXY, Z_STRVAL_P(zoption)); } +#endif /* dns */ if ((zoption = http_request_option(request, options, "dns_cache_timeout", IS_LONG))) { diff --git a/http_request_info.c b/http_request_info.c index 33694e7..f686d47 100644 --- a/http_request_info.c +++ b/http_request_info.c @@ -143,6 +143,11 @@ PHP_HTTP_API void _http_request_info(http_request *request, HashTable *info) add_assoc_double_ex(&array, "appconnect_time", sizeof("appconnect_time"), d); } #endif +#if HTTP_CURL_VERSION(7,19,4) + if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_CONDITION_UNMET, &l)) { + add_assoc_long_ex(&array, "condition_unmet", sizeof("condition_unmet"), l); + } +#endif /* END */ #if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL) { diff --git a/http_request_object.c b/http_request_object.c index 51e13a6..09c43a5 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -429,6 +429,9 @@ PHP_MINIT_FUNCTION(http_request_object) */ zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_BASIC")-1, CURLAUTH_BASIC TSRMLS_CC); zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_DIGEST")-1, CURLAUTH_DIGEST TSRMLS_CC); +#if HTTP_CURL_VERSION(7,19,3) + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_DIGEST_IE")-1, CURLAUTH_DIGEST_IE TSRMLS_CC); +#endif zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_NTLM")-1, CURLAUTH_NTLM TSRMLS_CC); zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_GSSNEG")-1, CURLAUTH_GSSNEGOTIATE TSRMLS_CC); zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_ANY")-1, CURLAUTH_ANY TSRMLS_CC); @@ -445,6 +448,9 @@ PHP_MINIT_FUNCTION(http_request_object) #endif zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_SOCKS5")-1, CURLPROXY_SOCKS5 TSRMLS_CC); zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_HTTP")-1, CURLPROXY_HTTP TSRMLS_CC); +# if HTTP_CURL_VERSION(7,19,4) + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_HTTP_1_0")-1, CURLPROXY_HTTP_1_0 TSRMLS_CC); +# endif #endif /* WONKY */ return SUCCESS; diff --git a/package2.xml b/package2.xml index 651e271..d54de51 100644 --- a/package2.xml +++ b/package2.xml @@ -42,19 +42,25 @@ support. Parallel requests are available for PHP 5 and greater. * Implement Request #14408 (Add a customizable timeout for HttpRequestPool::socketSelect) * Implement Request #15775 (recursive http_request_body_encode) * Added request options: + - proxytunnel: enable tunelling through the HTTP proxy - postredir: enforcing RFC conformig POST after redirect (libcurl >= 7.17.1) - address_scope: RFC4007 zone_id (libcurl >= 7.19.0) + - noproxy: comma separatet list of hosts (* means all hosts) not to use a proxy for (libcurl >= 7.19.4) - ssl->issuercert: validate peer certificate issuer (libcurl >= 7.19.0) - ssl->crlfile: require CRL check (libcurl >= 7.19.0 with openssl) - ssl->certinfo: enable the certinfo gatherer (libcurl >= 7.19.1 with openssl) +* Added authtype request option constant: + - HTTP_AUTH_DIGEST_IE * Added proxytype request option constants: - HTTP_PROXY_SOCKS4A - HTTP_PROXY_SOCKS5_HOSTNAME + - HTTP_PROXY_HTTP_1_0 * Added request info members: - redirect_url (libcurl >= 7.18.2) - primary_ip (libcurl >= 7.19.0) - appconnect_time (libcurl >= 7.19.0) - certinfo (libcurl >= 7.19.1 with openssl) + - condition_unmet (libcurl >= 7.19.4) ]]> @@ -191,6 +197,7 @@ support. Parallel requests are available for PHP 5 and greater. + diff --git a/scripts/gen_curlinfo.php b/scripts/gen_curlinfo.php index 52afecb..f234685 100644 --- a/scripts/gen_curlinfo.php +++ b/scripts/gen_curlinfo.php @@ -36,6 +36,7 @@ $ifdefs = array( 'PRIMARY_IP' => 'HTTP_CURL_VERSION(7,19,0)', 'APPCONNECT_TIME' => 'HTTP_CURL_VERSION(7,19,0)', 'REDIRECT_URL' => 'HTTP_CURL_VERSION(7,18,2)', + 'CONDITION_UNMET' => 'HTTP_CURL_VERSION(7,19,4)', ); $exclude = array( 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO',