Proxy Bypass Fails in Python <=2.6.5

It appears that when using a proxy bypass with an IP wthout a netmask causes an exception to be raised from requests in python <= 2.6.5. This is due to a bug in the stdlib which was fixed in 2.6.6.

Python bugs: http://bugs.python.org/issue10643 http://bugs.python.org/issue8883 
More information: https://github.com/pypa/pip/issues/1429

This is another issue that pip hit with the recent 1.5 release that is occuring on older 2.6 releases.


For ease of reading, here's the exception:

```
/Users/jerith/.virtualenvs/txTwitter/bin/pip run on Mon Jan  6 21:15:03 2014
Downloading/unpacking Twisted
  Getting page https://pypi.python.org/simple/Twisted/
Cleaning up...
  Removing temporary dir /Users/jerith/.virtualenvs/txTwitter/build...
Exception:
Traceback (most recent call last):
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/commands/install.py", line 270, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/req.py", line 1157, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/index.py", line 202, in find_requirement
    page = self._get_page(main_index_url, req)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/index.py", line 576, in _get_page
    session=self.session,
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/index.py", line 678, in get_page
    resp = session.get(url)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/_vendor/requests/sessions.py", line 394, in get
    return self.request('GET', url, **kwargs)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/download.py", line 236, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/_vendor/requests/sessions.py", line 355, in request
    env_proxies = get_environ_proxies(url) or {}
  File "/Users/jerith/.virtualenvs/txTwitter/lib/python2.6/site-packages/pip/_vendor/requests/utils.py", line 490, in get_environ_proxies
    if proxy_bypass(netloc):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1567, in proxy_bypass
    return proxy_bypass_macosx_sysconf(host)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1437, in proxy_bypass_macosx_sysconf
    mask = int(m.group(2)[1:])
TypeError: 'NoneType' object is unsubscriptable
```


Yeah, this is the same as #1841. If `pip` wasn't supporting old point-releases of 2.6 I'd be happy just to call this "not a problem", but you are, so we'll have to do something about it.


So, we already know that this buggy function _can_ throw `TypeError`s and `socket.gaierror`s. I don't know whether that scares me enough to just catch everything.


Fix is in #1845. Feel free to take a look, @dstufft.


Ok @dstufft, I think all the things you needed are merged (though I can't find the comment where you listed them).


@Lukasa Looks good to me. I had the reporter of the bugs test it out and he was able to successfully install stuff without error. So once @kennethreitz cuts a new release (hopefully soon!) pip 1.5.1 can vendor that release and close out those bugs.


Awesome, sounds good. =)


Ok, Requests 2.2.0 is out the door! pip 1.5.1 should be able to vendor that safely. As always, check the changelog (it's not very long).


It's already vendored :D I just forgot to close this sorry!