Skip to content
New issue

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

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

Already on GitHub? # to your account

nodeenv is not allowed to download iojs #125

Closed
csillag opened this issue Aug 28, 2015 · 5 comments
Closed

nodeenv is not allowed to download iojs #125

csillag opened this issue Aug 28, 2015 · 5 comments

Comments

@csillag
Copy link

csillag commented Aug 28, 2015

Hi,

When I try to install iojs vie nodeenv, I get this stack trace:

 * Install iojs (1.8.1Traceback (most recent call last):
  File "ann/admin/venv/bin/nodeenv", line 9, in <module>
    load_entry_point('nodeenv==0.13.3', 'console_scripts', 'nodeenv')()
  File "ann/admin/venv/local/lib/python2.7/site-packages/nodeenv.py", line 883, in main
    create_environment(env_dir, opt)
  File "ann/admin/venv/local/lib/python2.7/site-packages/nodeenv.py", line 724, in create_environment
    install_node(env_dir, src_dir, opt)
  File "ann/admin/venv/local/lib/python2.7/site-packages/nodeenv.py", line 593, in install_node
    download_node(node_url, src_dir, env_dir, opt)
  File "ann/admin/venv/local/lib/python2.7/site-packages/nodeenv.py", line 489, in download_node
    tar_contents = io.BytesIO(urlopen(node_url).read())
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

Analyzing the network traffic, I see that we are trying to do an HTTP request for http://iojs.org/dist/v1.8.1/iojs-v1.8.1-linux-x64.tar.gz, and we get a 403.

Looking at the body of the 403 message, I can extract this information:

  • Access denied | iojs.org used CloudFlare to restrict access
  • The owner of this website (iojs.org) has banned your access based on your browser's signature (21d0f4c3229b0aa2-ua48).

The way I interpret this, it looks like (until the iojs.org guys change their settings) it will be impossible to install iojs using nodeenv. (Or whichever library, that was responsible for generating this "browser signature".)

However, downloading iojs with (for example) wget works just fine....

Do you have any idea where this "browser signature" thing comes from? Or why the iojs guys decided to forbid downloads from nodeenv?

Thank you for the help!

@csillag csillag changed the title nodeenv if not allowed to download iojs nodeenv is not allowed to download iojs Aug 28, 2015
@nsb
Copy link

nsb commented Aug 31, 2015

+1

@rvagg
Copy link

rvagg commented Aug 31, 2015

This is going to become a bigger problem because nodejs.org is shifting to CloudFlare too. Can I suggest changing the urlopen() used to fetch the source to include a custom User-Agent for the tool, something like:

import urllib
...
req = urllib.request.Request(
    node_url, 
    data=None, 
    headers={
        'User-Agent': 'Nodeenv'
    }
)
f = urllib.request.urlopen(req)

Or even pretend to be a normal browser with a standard User-Agent.

@ekalinin
Copy link
Owner

Just pushed 0.13.4, it work for me atm.
Test it, please.

@csillag
Copy link
Author

csillag commented Aug 31, 2015

Just pushed 0.13.4, it work for me atm.
Test it, please.

It works for me, too. Problem solved, as far as I am concerned.

Shall I close this issue now?

@ekalinin
Copy link
Owner

It works for me, too. Problem solved, as far as I am concerned.

Great!

Shall I close this issue now?

I can do it :)

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

No branches or pull requests

4 participants