Bug #74800 [NEW]: cURL Improperly Sets Proxy-Connect Header

From: Date: Thu, 22 Jun 2017 19:36:37 +0000
Subject: Bug #74800 [NEW]: cURL Improperly Sets Proxy-Connect Header
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209632@lists.php.net to get a copy of this message
From: cmanalio at gmail dot com Operating system: Centos 6.9 PHP version: 7.0.20 Package: cURL related Bug Type: Bug Bug description:cURL Improperly Sets Proxy-Connect Header 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 -- Edit bug report at https://bugs.php.net/bug.php?id=74800&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74800&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74800&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74800&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74800&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74800&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74800&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74800&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74800&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74800&r=support Expected behavior: https://bugs.php.net/fix.php?id=74800&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74800&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74800&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74800&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74800&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74800&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74800&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74800&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74800&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74800&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74800&r=mysqlcfg

« previous php.bugs (#209632) next »