1
0
Fork 0

Add user-agent header to json fetches, fixes #39

pull/48/head
Jordi Boggiano 2011-10-02 22:39:15 +02:00
parent 2ebc795754
commit be769ea1ac
1 changed files with 6 additions and 1 deletions

View File

@ -13,6 +13,7 @@
namespace Composer\Json;
use Composer\Repository\RepositoryManager;
use Composer\Composer;
/**
* Reads/writes json files.
@ -52,7 +53,11 @@ class JsonFile
*/
public function read()
{
$json = file_get_contents($this->path);
$context = stream_context_create(array(
'http' => array('header' => 'User-Agent: Composer/'.Composer::VERSION."\r\n")
));
$json = file_get_contents($this->path, false, $context);
return static::parseJson($json);
}