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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC