TYPO3 / CmsComposerInstallers

TYPO3 CMS Composer Installer
GNU General Public License v2.0
58 stars 39 forks source link

Can't parse json with http / https proxy #8

Closed khaefeli closed 9 years ago

khaefeli commented 9 years ago

Hi!

I'm using composer with an http / https proxy (based on apache 2.2)

composer --verbose diag says:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: OK
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

but if I install TYPO3 over:

composer create-project typo3/cms-base-distribution CmsBaseDistribution

I get:

[Seld\JsonLint\ParsingException]                                        
"https://get.typo3.org/json" does not contain valid JSON                
Parse error on line 1:                                                  
<!DOCTYPE html><htm                                                     
 ^                                                                       
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

which comes from: https://github.com/TYPO3/CmsComposerInstallers/blob/master/Classes/TYPO3/CMS/Composer/Installer/CoreInstaller/GetTypo3OrgService.php

It seams, that it is a SSL related issue. With my workaround, everything is OK:

https://github.com/khaefeli/CmsComposerInstallers/commit/b53da55ac7d34bdafaac729914c302a05ac89c6c

composer.json (fail)

{
"repositories": [
    {"type": "vcs", "url": "https://github.com/TYPO3/CmsComposerInstallers" }
],
"require": {
"typo3/cms-composer-installers": "1.1.*@dev",
"typo3/cms": "~6.2"
}
}

composer.json (works)

{
"repositories": [
    {"type": "vcs", "url": "https://github.com/khaefeli/CmsComposerInstallers" }
],
"require": {
"typo3/cms-composer-installers": "1.1.*@dev",
"typo3/cms": "~6.2"
}
}

maybe it's related to the OpenSSL / TLS version from get.typo3.org. (only TLS 1.0 is supported because of the old openssl installation)

maybe it's related to the following issue: https://github.com/composer/composer/issues/3204

Regards, Kevin

fabarea commented 9 years ago

It could be it was a temporary issue like get.typo3.org was down for a moment. I have just tested and it works for me.

composer create-project typo3/cms-base-distribution CmsBaseDistribution
khaefeli commented 9 years ago

@fabarea did you test it behind an http proxy? get.typo3.org was up and running the whole time.

fabarea commented 9 years ago

ah sorry, didn't read carefully enough. So the output of https://get.typo3.org/json is not a valid JSON behind the proxy if I believe your message above. Is it some more useful information in the message?

khaefeli commented 9 years ago

no problem :-) the output with "composer install" and the composer.json above is:

Exception    trace:
()    at    phar:///usr/local/bin/composer/src/Composer/Json/JsonFile.php:289
Composer\Json\JsonFile::validateSyntax()    at    phar:///usr/local/bin/composer/src/Composer/Json/JsonFile.php:261
Composer\Json\JsonFile::parseJson()    at    phar:///usr/local/bin/composer/src/Composer/Json/JsonFile.php:94
Composer\Json\JsonFile->read()    at    /tmp/vendor/typo3/cms-composer-installers/Classes/TYPO3/CMS/Composer/Installer/CoreInstaller/GetTypo3OrgService.php:57
TYPO3\CMS\Composer\Installer\CoreInstaller\GetTypo3OrgService->initializeData()    at    /tmp/vendor/typo3/cms-composer-installers/Classes/TYPO3/CMS/Composer/Installer/CoreInstaller/GetTypo3OrgService.php:65
TYPO3\CMS\Composer\Installer\CoreInstaller\GetTypo3OrgService->addDistToPackage()    at    /tmp/vendor/typo3/cms-composer-installers/Classes/TYPO3/CMS/Composer/Installer/CoreInstaller.php:109
TYPO3\CMS\Composer\Installer\CoreInstaller->install()    at    phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:152
Composer\Installer\InstallationManager->install()    at    phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:139
Composer\Installer\InstallationManager->execute()    at    phar:///usr/local/bin/composer/src/Composer/Installer.php:578
Composer\Installer->doInstall()    at    phar:///usr/local/bin/composer/src/Composer/Installer.php:225
Composer\Installer->run()    at    phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:131
Composer\Command\InstallCommand->execute()    at    phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run()    at    phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand()    at    phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun()    at    phar:///usr/local/bin/composer/src/Composer/Console/Application.php:147
Composer\Console\Application->doRun()    at    phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run()    at    phar:///usr/local/bin/composer/src/Composer/Console/Application.php:84
Composer\Console\Application->run()    at    phar:///usr/local/bin/composer/bin/composer:43
require()    at    /usr/local/bin/composer:25

important: if I change the url from https to http, everything is working. (still behind the proxy)

fabarea commented 9 years ago

I see. Actually, I wanted to see more the output of the faulty /json <!DOCTYPE html><htm...

Anyway, can you search digging and see if the issue is related to TLS <= 1.0 and whether an upgrade towards 1.1 or 1.2 would really fix the problem. There is not only get.typo3.org as instance on the server...

susannemoog commented 9 years ago

See my comment at https://github.com/composer/composer/issues/3204 - try playing around with the request full uri settings.

tmaroschik commented 9 years ago

Seems to work for @khaefeli

I'll close this.