php.net |  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
Votes:4
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: francois dot bonzon at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-11 04:11 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 17:30 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2019-03-26 17:30 UTC] mike@php.net
.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 00:01:25 2019 UTC