Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer install of plugin results in "Content-Length mismatch, received 0 out of 290 bytes: ()" #1294

Closed
mariagwyn opened this issue Nov 30, 2017 · 7 comments

Comments

@mariagwyn
Copy link

Composer install of plugin results in "Content-Length mismatch, received 0 out of 290 bytes: ()"

Related issues:

To Reproduce

  1. Add the following code to composer file:
"ckeditor.autogrow": {
      "type": "package",
      "package": {
        "name": "ckeditor/autogrow",
        "version": "4.6.2",
        "type": "drupal-library",
        "extra": {
          "installer-name": "ckeditor.autogrow"
        },
        "dist": {
          "url": "http://download.ckeditor.com/autogrow/releases/autogrow_4.6.2.zip",
          "type": "zip"
        },
        "require": {
          "composer/installers": "~1.0"
        }
      }
    },

Then in your require section:
"ckeditor/autogrow": "4.6.2",

  1. Run composer install

Expected result

The successful install of ckeditor/autogrow in specified (libraries) folder.

Actual result

Composer fails to install with this error:
Content-Length mismatch, received 0 out of 290 bytes: ()

Other details

@FlorentTorregrosa
Copy link

Hello,

There is a misunderstanding.

I have confirmed that the above code in composer.json file worked for me. But as I don't use it anymore due to new versions of the plugin, I can't confirm it does not work anymore for this particular version.

@mariagwyn
Copy link
Author

@FlorentTorregrosa: it seems that the code which you had working at one point no longer works. That is the issue here.

@bobbygryzynger
Copy link

bobbygryzynger commented Dec 1, 2017

I can also comfirm I'm seeing this problem with ckeditor/fakeobjects (4.7.3), ckeditor/image (4.7.3) and ckeditor/link (4.6.2).

Oddly, if I go to the dist urls I am able to download the zip files without any problems, for instance ckeditor/fakeobjects:4.7.3. This makes me think that this could be a composer issue at its heart.

If I store the library locally, as in "url": "/Users/<user>/Downloads/fakeobjects_4.7.3.zip" I am able to install it with composer.

I'm using the following version of composer.

$ composer --version
Composer version 1.5.2 2017-09-11 16:59:25

@RDeuzeman
Copy link

After updating my composer to version 1.5.5 I got a detailed error when trying to install.

  [Composer\Downloader\TransportException]                                     
  The "https://ckeditor.com/cke4/sites/default/files/colorbutton/releases/col  
  orbutton_4.6.2.zip" file could not be downloaded: SSL operation failed with  
   code 1. OpenSSL Error messages:                                             
  error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify   
  failed                                                                       
  Failed to enable crypto                                                      
  failed to open stream: operation failed 

So the problem is a wrong or missing ssl certificate.

Printing the certificate locations in PHP showed me the following settings.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => 
    [ini_capath] => 
)

After setting ini_cafile in php.ini to the location of the cert.pem file (same setting as default_cert_file) the error is gone and composer can download the plugins.

My config after the change.

php -r 'print_r(openssl_get_cert_locations());'
Array
(
    [default_cert_file] => /usr/local/etc/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/etc/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/etc/openssl/private
    [default_default_cert_area] => /usr/local/etc/openssl
    [ini_cafile] => /usr/local/etc/openssl/cert.pem
    [ini_capath] => 
)

@bobbygryzynger
Copy link

Thanks @RDeuzeman, the steps above fixed this issue for me.

@mariagwyn
Copy link
Author

Interesting. That is not the original error I received, and I was on composer 1.5.5. I attempted your fix, but am still getting this new SSL error. Any suggestions?

@mariagwyn
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants