Fixed pecl bug #16817 (Proxy-Auth. and WWW-Auth. credentials mixed after connection...
authorMichael Wallner <mike@php.net>
Wed, 2 Sep 2009 12:07:00 +0000 (12:07 +0000)
committerMichael Wallner <mike@php.net>
Wed, 2 Sep 2009 12:07:00 +0000 (12:07 +0000)
http_request_api.c

index 817fa3a805af01da86e35de18b6c575aeb79868a..1d1252a0988399b783dd28089ec9f847246f4990 100644 (file)
@@ -477,7 +477,9 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(CURLOPT_PROXY, NULL);
                HTTP_CURL_OPT(CURLOPT_PROXYPORT, 0L);
                HTTP_CURL_OPT(CURLOPT_PROXYTYPE, 0L);
-               HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, NULL);
+               /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */
+               HTTP_CURL_OPT(CURLOPT_PROXYUSERNAME, NULL);
+               HTTP_CURL_OPT(CURLOPT_PROXYPASSWORD, NULL);
                HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0L);
                HTTP_CURL_OPT(CURLOPT_HTTPPROXYTUNNEL, 0L);
                HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, 60L);
@@ -496,11 +498,16 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(CURLOPT_FORBID_REUSE, 0L);
                HTTP_CURL_OPT(CURLOPT_INTERFACE, NULL);
                HTTP_CURL_OPT(CURLOPT_PORT, 0L);
+#if HTTP_CURL_VERSION(7,19,0)
+               HTTP_CURL_OPT(CURLOPT_ADDRESS_SCOPE, 0L);
+#endif
 #if HTTP_CURL_VERSION(7,15,2)
                HTTP_CURL_OPT(CURLOPT_LOCALPORT, 0L);
                HTTP_CURL_OPT(CURLOPT_LOCALPORTRANGE, 0L);
 #endif
-               HTTP_CURL_OPT(CURLOPT_USERPWD, NULL);
+               /* libcurl < 7.19.6 does not clear auth info with USERPWD set to NULL */
+               HTTP_CURL_OPT(CURLOPT_USERNAME, NULL);
+               HTTP_CURL_OPT(CURLOPT_PASSWORD, NULL);
                HTTP_CURL_OPT(CURLOPT_HTTPAUTH, 0L);
                HTTP_CURL_OPT(CURLOPT_ENCODING, NULL);
 #if HTTP_CURL_VERSION(7,16,2)
@@ -519,6 +526,9 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(CURLOPT_USERAGENT, "PECL::HTTP/" PHP_HTTP_VERSION " (PHP/" PHP_VERSION ")");
                HTTP_CURL_OPT(CURLOPT_HTTPHEADER, NULL);
                HTTP_CURL_OPT(CURLOPT_COOKIE, NULL);
+               HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 0L);
+               HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL);
+               HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL);
 #if HTTP_CURL_VERSION(7,14,1)
                HTTP_CURL_OPT(CURLOPT_COOKIELIST, NULL);
 #endif