I wanted to create a new release of xc_installation project. It is a Drupal distribution, and has a drupal-org.make file. The make file is usually veryfied agains a whitelist. Today when I tried the create a new release package, I received an error message:

The drupal-org.make file for project eXtensible Catalog (XC) Installation Profile failed verification for Git tag 6.x-1.3-rc9.

http://drupal.org/node/642116 -- to learn more about correcting these errors.
Whitelist download from http://drupal.org/packaging-whitelist/json [error]
failed: not found
The drupal.org validation check failed -- see [error]
http://drupal.org/node/1432190 for more information.

Once these errors are fixed, commit the changes to your drupal-org.make, move the release tag for your project (check the Git manual to learn how to move tags if necessary), and submit the release node again.

I read all pages which are referred in this error message, and tried to veryfy the make file in local environment with drush verify-makefile command, and I received this warning message:

http://drupal.org/packaging-whitelist/json): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden. You should know better.

Then I tried to access the file with file_get_content(), and it also failed.

$ php -r "file_get_contents('http://drupal.org/packaging-whitelist/json');"

Warning: file_get_contents(http://drupal.org/packaging-whitelist/json): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden. You should know better.
 in Command line code on line 1

Call Stack:
    0.0001     646904   1. {main}() Command line code:0
    0.0001     647160   2. file_get_contents() Command line code:1

When I hacked drush to use cURL method, the result was the same.

The strangest thing is, that the file is there, I can access it with browser, and with command line curl and wget tools. I guess, that the packaging script use some similar (if not even identical) method to fetch the file as Drush.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

artofeclipse’s picture

I'm facing this issue right now, trying to get it working but no luck, I will keep investigating this issue for now.

klausi’s picture

killes said that there has been a request filter deployed on drupal.org yesterday which blocks requests without User-Agent. Apparently file_get_contents() does not send a User-Agent, so it is blocked.

Do we fix drupalorg_drush to not use file_get_contents() or do we roll back the request filter on drupal.org?

greggles’s picture

Title: Whitelist download failed » Whitelist download failed - replace file_get_contents with something that sends a User-Agent
Project: Drupal.org infrastructure » Drupal.org customizations
Version: » 6.x-3.x-dev
Component: Packaging » Code

The request filter let drupal.org's servers stay online, so I think we keep it and patch drupalorg_drush.

klausi’s picture

Title: Whitelist download failed - replace file_get_contents with something that sends a User-Agent » Whitelist download failed
Project: Drupal.org customizations » Drupal.org drush
Version: 6.x-3.x-dev »
Status: Active » Needs review
FileSize
1.87 KB

Moving to drupalorg_drush.

This patch tries cURL first and adds a user agent.

I get a lot of phpunit test failures with that, need to check if they pass without it.

klausi’s picture

Title: Whitelist download failed » Whitelist download failed - replace file_get_contents with something that sends a User-Agent

Restoring title.

klausi’s picture

cd tests
phpunit --bootstrap=/home/klausi/workspace/drush/tests/drush_testcase.inc drupalorgTest.php

Reports 17 failures before and after the patch, so the test cases seem to be broken anyway.

killes@www.drop.org’s picture

Seems good to me. We should let somebody else review it too, and then deploy it asap.

artofeclipse’s picture

patch #4 worked on my local machine

jsacksick’s picture

Status: Needs review » Reviewed & tested by the community

I just tested the patch against the drupal-org.make file of kickstart and It worked.
drush verify-makefile drupal-org.make
Makefile drupal-org.make passed.

jhedstrom’s picture

#4 looks good to me. Committed in 69e3e69. I'll leave this at RTBC so somebody can deploy the fix.

drumm’s picture

Assigned: Unassigned » drumm
Status: Reviewed & tested by the community » Fixed

As I was deploying this, I noticed our deployment system for this was broken a bit. We have a couple Jenkins jobs for this, started by deploy_packaging_drush_drupal.org. Both had the same script in Jenkins, so I moved it to our infrastructure repo, http://drupalcode.org/project/infrastructure.git/blob/036b8b8:/live/depl.... I added the last line, which actually merges in changes if you are updating a branch. The git_id parameter advertises "Can be either a branch name, tag, or even a specific commit hash." I think I might have broken specific commit hashes.

I'd like to see the whole drupalorg_drush_get_remote_file() function replaced with drush_download_file() or something. drupal_http_request() would be ideal since it loads directly to memory, but this drush command is not invoked on a bootstrapped Drupal install.

pkiraly’s picture

Thank you all! It works again, and I was able to create a new release.

dww’s picture

Cool, thanks everyone!

Re #11:

I'd like to see the whole drupalorg_drush_get_remote_file() function replaced with drush_download_file() or something.

See #1401864: more robust download functionality

Cheers,
-Derek

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

lolandese’s picture

Still some problems with this. Still a 403 forbidden error on http://drupal.org/packaging-whitelist/json when using fopen method.

From my terminal:

martin@martin-X501A1:~/Downloads/Drupal/scald_galaxy-7.x-1.x-dev/profiles/scald_galaxy$ sudo drush verify-makefile
[sudo] password for martin: 
Starting Drupal.org contrib makefile validation, please wait         [ok]
file_get_contents(http://drupal.org/packaging-whitelist/json): failed[warning]
to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
 drupalorg_drush.drush.inc:818
Whitelist download from http://drupal.org/packaging-whitelist/json   [error]
failed: not found
The Drupal.org validation check failed -- see                        [error]
http://drupal.org/node/1432190 for more information.

Using the latest version:
git clone [user]@git.drupal.org:project/drupalorg_drush.git drupalorg_drush

Any hints on what I'm doing wrong?

Thanks.

EDIT:
Solved by enabling cURL, so it takes that method instead of fopen:
sudo apt-get install php5-curl

Maybe something to look into anyway as it fails when cURL is not enabled. No idea if it would fail also using the wget method.

lolandese’s picture

Status: Closed (fixed) » Active

Still seems to fail if cURL is not enabled. See above.

Thanks.

drumm’s picture

Assigned: drumm » Unassigned
Priority: Critical » Normal
dww’s picture

I wonder if the problem is http vs. https. The http should redirect to https, but maybe that's not happening for your client. What happens if you try to directly curl https://drupal.org/packaging-whitelist/json instead?

Claire Hernandez’s picture

Hi,

I got the same problem but the answer does seem working for me. Another idea ?

$ drush verify-makefile
                            [warning]ackaging-whitelist/json): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden. You should know better.
 drupalorg_drush.drush.inc:787
Whitelist download from http://drupal.org/packaging-whitelist/json failed: not found                                                                                                   [error]
The drupal.org validation check failed -- see http://drupal.org/node/1432190 for more information.                                                                                     [error]

$ dpkg -l |grep curl
ii  curl                                   7.22.0-3ubuntu4                         Get a file from an HTTP, HTTPS or FTP server
ii  libcurl3                               7.22.0-3ubuntu4                         Multi-protocol file transfer library (OpenSSL)
ii  libcurl3-gnutls                        7.22.0-3ubuntu4                         Multi-protocol file transfer library (GnuTLS)
ii  libcurl3-nss                           7.22.0-3ubuntu4                         Multi-protocol file transfer library (NSS)
ii  php5-curl                              5.3.10-1ubuntu3.8                       CURL module for php5
ii  python-pycurl                          7.19.0-4ubuntu3                         Python bindings to libcurl

$ php -m | grep curl
curl

$ drush status
 PHP executable        :  /usr/bin/php          
 PHP configuration     :  /etc/php5/cli/php.ini 
 PHP OS                :  Linux                 
 Drush version         :  6.1.0                 
 Drush configuration   :                        
 Drush alias files     :                    

Thanks.

bart.hanssens’s picture

Same here, using drush 5.9 on Debian, with php5-curl installed.

Devin Carlson’s picture

Issue summary: View changes
FileSize
587 bytes

Same issue as #19 and #20 whether I use cURL or allow_url_fopen() (only the error message changes).

I read Details on Server SSL Certificates and was able to bypass the issue by using cURL and specifying:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

although I'm not sure that's a good idea. :P