|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-03-26 17:39 UTC] mike@php.net
-Status: Open
+Status: Feedback
[2019-03-26 17:39 UTC] mike@php.net
[2019-04-07 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 19:00:02 2025 UTC |
Description: ------------ 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: --------------- <?php //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, "http://www.xhaus.com/headers"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); var_dump($result); ?> Expected result: ---------------- HTTP Header* Value Accept */* Connection close Host www.xhaus.com 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 Host www.xhaus.com Proxy-Connection Keep-Alive User-Agent Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0