Bug #68211 [NEW]: New value for CURLOPT_PROXY is ignored, old value is re-used
| From: | francois dot bonzon at gmail dot com | Date: | Sat, 11 Oct 2014 04:11:13 +0000 |
| Subject: | Bug #68211 [NEW]: New value for CURLOPT_PROXY is ignored, old value is re-used | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188015@lists.php.net to get a copy of this message | ||
From: francois dot bonzon at gmail dot com
Operating system: Mac OS X 10.9.5
PHP version: 5.4.33
Package: cURL related
Bug Type: Bug
Bug description:New value for CURLOPT_PROXY is ignored, old value is re-used
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 bug report at https://bugs.php.net/bug.php?id=68211&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68211&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68211&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68211&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68211&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68211&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68211&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68211&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68211&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68211&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68211&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68211&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68211&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68211&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68211&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68211&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68211&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68211&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68211&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68211&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68211&r=mysqlcfg