|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74800 cURL Improperly Sets Proxy-Connect Header
Submitted: 2017-06-22 19:36 UTC Modified: 2019-04-07 04:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: cmanalio at gmail dot com Assigned:
Status: No Feedback Package: cURL related
PHP Version: 7.0.20 OS: Centos 6.9
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.
Block user comment
Status: Assign to:
Bug Type:
From: cmanalio at gmail dot com
New email:
PHP Version: OS:


 [2017-06-22 19:36 UTC] cmanalio at gmail dot com
When using a proxy, the PHP Curl wrapper does not allow the user to remove or modify the Proxy-Connect header. PHP cURL will set a hard-coded "Proxy-Connect: Keep-alive" value, no matter if the user requests to disable this behavior by setting the header to null. Additionally, if the user would like to set "Proxy-Connect" to "Closed", this is impossible as cURL will still send the "Keep-Alive" header and append "Closed" afterwards, like so:
"Proxy-Connect: Keep-alive, Closed"

Test script:
//Proxy-Connection is not set, desired behavior is to remove this header from the request. The command line version of cURL does so properly, but PHP still sends it.
$headers = array('Proxy-Connection:');            

$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $GLOBALS['proxyserver']);
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);


Expected result:
HTTP Header*	Value
Accept	*/*
Connection	close
User-Agent	Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0

Actual result:
HTTP Header*	Value
Accept	*/*
Connection	close
Proxy-Connection	Keep-Alive
User-Agent	Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-26 17:39 UTC]
-Status: Open +Status: Feedback
 [2019-03-26 17:39 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

 [2019-04-07 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 09:01:27 2023 UTC