bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
456 stars 92 forks source link

No proxy suppoert #31

Closed gkalab-snippets closed 11 years ago

gkalab-snippets commented 12 years ago

I've http_proxy and https_proxy envirionment variables set but sublime-github does not take it into account. I get no connection through a proxy. I'm on Windows 7.

bgreenlee commented 12 years ago

Thanks for reporting this. I'll look into it when I get a chance (pull requests are welcome, though :).

astratto commented 11 years ago

Note: now we're waiting for this: https://github.com/shazow/urllib3/pull/170

aktau commented 11 years ago

I don't know why my comments are not being accepted, but you definitely forgot to add the proxies argument to

    def request(self, method, url, headers=None, params=None, data=None, auth=None, allow_redirects=False, config=None, proxies=None):

(line 55 of sublime_requests.py).

As it stands, nothing works anymore...

astratto commented 11 years ago

Uhm... that's not entirely true. As far as I can see, it won't work only if hasattr(httplib, "HTTPSConnection") is true and thus it fallbacks to curl.

I need to add proxy support to CurlSession as well. Thanks!

aktau commented 11 years ago

Alright, then it's not true and my installation is just very weird. Just wanted to let you guys know that I "fixed" it by changing add Proxies=none to line 55 of sublime_requests.py. The reason I found out about it was this error:

Click OK and then enter your GitHub username and password below (neither will be stored; they are only used to generate an access token).
Traceback (most recent call last):
  File "./sublime_github.py", line 84, in on_done_password
  File "./github.py", line 57, in get_token
  File "./sublime_requests.py", line 84, in post
TypeError: request() got an unexpected keyword argument 'proxies'

(that was a fresh installation from earlier this morning)

astratto commented 11 years ago

Sorry if I sounded a bit harsh, it wasn't absolutely my intention but I just wanted to narrow the issue.

The real fix is to correctly handle that new param, I'll do it as soon as possible. Thanks again!

aktau commented 11 years ago

No offense was taken at all, but I suspected something would be wrong with peoples' installs anyway (since my sublime is fresh and I just installed package control and sublime-github), so I logged the fix here for posterity. The error clearly indicated to me that the param was unknown to some function so I narrowed it down, added it and the plugin started functioning again. Quite possibly something else needed to be done as you said, but I'm no python expert at all so I wouldn't know what crazy monkey business goes on in there.

No problem.

bgreenlee commented 11 years ago

Sorry, @Aktau, I was a bit premature in merging that. I've reverted @astratto's 55f77f for now, until the necessary changes have been made to requests (since it's not going to work anyway without that).

astratto commented 11 years ago

Uh, sometimes GitHub puzzles me... I didn't want to make those references public...

Anyway, I've been working on enabling proxy support also for curl mode and from the preliminary tests it seems that that can be the only way to use sublime-github behind a proxy.

@bgreenlee if you agree we might add a flag to enable/disable curl mode, because as I said, people behind a proxy (like me at the moment) might be interested in skip requests for the time being and instead use a working proxy solution based on curl.

astratto commented 11 years ago

@bgreenlee I've just sent a pull request (https://github.com/bgreenlee/sublime-github/pull/42) to enable proxy support for both curl mode and requests mode (not working at the moment). Feel free to cherry pick what you need.

bgreenlee commented 11 years ago

@Ataku - I merged @astratto's latest pull request. Could you verify that it still works for you? (I tested it myself on OS X and it worked for me.)

astratto commented 11 years ago

@bgreenlee you've misspelled it... he's @Aktau :smile:

aktau commented 11 years ago

Package control does auto-updating no? I just tried opening a gist and it worked very well indeed!