|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68211 New value for CURLOPT_PROXY is ignored, old value is re-used
Submitted: 2014-10-11 04:11 UTC Modified: 2019-03-26 17:30 UTC
Avg. Score:3.0 ± 1.2
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: francois dot bonzon at gmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.4.33 OS: Mac OS X 10.9.5
Private report: No CVE-ID: None
 [2014-10-11 04:11 UTC] francois dot bonzon at gmail dot com
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, in my attached test script is an example that does reproduce the bug. However does not reproduce the bug, for example.

cURL version: 7.30.0

Test script:

# To reproduce the bug, change '' and
# '' 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, '');
curl_setopt($ch, CURLOPT_PROXY, '');
curl_setopt($ch, CURLOPT_PROXY, '');


Expected result:
The second curl_exec() call is tunneled through ''.

Output contains:

* About to connect() to proxy port 80 (#1)

Actual result:
The second curl_exec() call is tunneled through ''.

Output contains:

* Re-using existing connection! (#0) with host


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 17:30 UTC]
-Status: Open +Status: Not a bug
 [2019-03-26 17:30 UTC]
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 05:01:25 2021 UTC