fix proxy support

fix for #837 

needs review and some more real testing.
I did confirm myself using a local proxy server.

to test it:
```
pip install --ignore-installed git+https://github.com/qwcode/pip@proxy_fix#egg=pip
```