Skip to content

Commit

Permalink
No longer sending an Accept and Accept-Encoding header by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Oct 15, 2012
1 parent 83e2e64 commit 71fac84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Curl/CurlHandle.php
Expand Up @@ -62,8 +62,6 @@ public static function factory(RequestInterface $request)
CURLOPT_RETURNTRANSFER => false,
CURLOPT_HEADER => false,
CURLOPT_USERAGENT => (string) $request->getHeader('User-Agent'),
// Supports all encodings
CURLOPT_ENCODING => '',
CURLOPT_PORT => $request->getPort(),
CURLOPT_HTTPHEADER => array(),
CURLOPT_HEADERFUNCTION => array($mediator, 'receiveResponseHeader'),
Expand Down Expand Up @@ -197,6 +195,11 @@ public static function factory(RequestInterface $request)
}
}

// Do not set an Accept header by default
if (!isset($curlOptions[CURLOPT_ENCODING])) {
$curlOptions[CURLOPT_HTTPHEADER][] = 'Accept:';
}

// Check if any headers or cURL options are blacklisted
if ($client && ($blacklist = $client->getConfig('curl.blacklist'))) {
foreach ($blacklist as $value) {
Expand Down

0 comments on commit 71fac84

Please sign in to comment.