Bug #68211 [Opn->Nab]: New value for CURLOPT_PROXY is ignored, old value is re-used

From: Date: Tue, 26 Mar 2019 17:30:03 +0000
Subject: Bug #68211 [Opn->Nab]: New value for CURLOPT_PROXY is ignored, old value is re-used
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220204@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68211&edit=1 ID: 68211 Updated by: mike@php.net Reported by: francois dot bonzon at gmail dot com Summary: New value for CURLOPT_PROXY is ignored, old value is re-used -Status: Open +Status: Not a bug Type: Bug Package: cURL related Operating System: Mac OS X 10.9.5 PHP Version: 5.4.33 Block user comment: N Private report: N New Comment: . Previous Comments: ------------------------------------------------------------------------ [2014-10-11 04:11:11] francois dot bonzon at gmail dot com Description: ------------ In some cases, despite changing the proxy of a cURL handle, subsequent transfers will keep using the old proxy. The bug does not occur with every URL, presumably due to presence or not of "Connection: keep-alive" header in the server response. I was able to reproduce only with some https:// URLs, https://php.net/curl in my attached test script is an example that does reproduce the bug. However http://example.com/ does not reproduce the bug, for example. cURL version: 7.30.0 Test script: --------------- <?php # To reproduce the bug, change 'proxy1.example.com:80' and # 'proxy2.example.com:80' below with hostname:port of actual proxies. They must # each resolve to a different IP address. $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, TRUE); curl_setopt($ch, CURLOPT_NOBODY, TRUE); curl_setopt($ch, CURLOPT_URL, 'https://php.net/curl'); curl_setopt($ch, CURLOPT_PROXY, 'proxy1.example.com:80'); curl_exec($ch); curl_setopt($ch, CURLOPT_PROXY, 'proxy2.example.com:80'); curl_exec($ch); curl_close($ch); ?> Expected result: ---------------- The second curl_exec() call is tunneled through 'proxy2.example.com'. Output contains: * About to connect() to proxy proxy2.example.com port 80 (#1) Actual result: -------------- The second curl_exec() call is tunneled through 'proxy1.example.com'. Output contains: * Re-using existing connection! (#0) with host proxy1.example.com ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68211&edit=1

« previous php.bugs (#220204) next »