Bug #74800 [Opn->Fbk]: cURL Improperly Sets Proxy-Connect Header
Edit report at https://bugs.php.net/bug.php?id=74800&edit=1
ID: 74800
Updated by: mike@php.net
Reported by: cmanalio at gmail dot com
Summary: cURL Improperly Sets Proxy-Connect Header
-Status: Open
+Status: Feedback
Type: Bug
Package: cURL related
Operating System: Centos 6.9
PHP Version: 7.0.20
Block user comment: N
Private report: N
New Comment:
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 http://www.php.net/downloads.php
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.
Previous Comments:
------------------------------------------------------------------------
[2017-06-22 19:36:34] cmanalio at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=74800&edit=1
Thread (3 messages)