clarete / hackernews.el

Hacker News client for Emacs
GNU General Public License v3.0
248 stars 26 forks source link

Support for HTTP proxy #27

Closed andylhxu closed 6 years ago

andylhxu commented 7 years ago

Are there supports for setting up HTTP proxies for the HN emacs client?

clarete commented 7 years ago

There isn't any support yet but that's indeed a good idea!

andylhxu commented 7 years ago

It would be nice to have it since I bet a lot of the use cases are inside internal networks.

clarete commented 7 years ago

Hi @andylhxu, I took some time to look a lil deeper at the issue.

hackernews.el uses url.el, I believe that setting url-proxy-services might suffice. I grabbed the following snippet from a StackOverflow answer:

(setq url-proxy-services '(("no_proxy" . "work\\.com")
                           ("http" . "proxy.work.com:911")))
andylhxu commented 7 years ago

@clarete Yep, I have the proxy set up because i need to packages from melpa from the internal network. However, it didn't work for the hackernews client.

Tried today with proxies configured. Works for downloading packages from melpa/elpa, but doesn't work for hackernews... web access to news.ycombinator.com is not blocked so I assumed that the backend APIs shouldn't as well?

clarete commented 7 years ago

@andylhxu, let's reopen this bug if your test confirms that it's not enough.

andylhxu commented 7 years ago

confirmed, the proxy configuration with url-proxy-service is not sufficient.

clarete commented 7 years ago

OK! Let's reopen the issue and figure out how it could work! Thanks for testing that!

basil-conto commented 7 years ago

For what it's worth, here are the relevant nodes from the url.el manual on proxies and gateways in general.

basil-conto commented 6 years ago

@andylhxu It would be very helpful if you could provide some more information on this. For example, what is your emacs-version? Have you tried setting url-debug to t and inspecting the contents of the *URL-DEBUG* buffer?

The only differences between package.el and hackernews.el in their usage of url.el are:

  1. package-archives used to default to HTTP addresses in older versions of Emacs (but not anymore), whereas hackernews.el always uses HTTPS access points; and
  2. package.el defaults to asynchronous retrieval via url-retrieve, whereas hackernews.el always does synchronous retrieval via url-retrieve-synchronously.

Re: (1), can you please check whether your package-archives include any HTTPS addresses? Do other uses of TLS work for you, e.g. M-xewwREThttps://gnu.orgRET? Newer versions of Emacs have GnuTLS built-in, which makes working with TLS much faster and more reliable from what I gather. If you are on an older Emacs, perhaps it's just a matter of modifying your GnuTLS configuration.

Re: (2), can you try setting package-menu-async to nil and see if M-xlist-packagesRET still works for you?

basil-conto commented 6 years ago

I have a feeling this issue might be caused by GNU Emacs bug#11788, which should be fixed in Emacs 26.

@andylhxu Any chance you can try it out in Emacs 26 and report back?

Either way I'm closing this issue as I don't think there is much hackernews can do. If the proxy still does not work for you in Emacs 26, please consider filing a bug via M-xreport-emacs-bugRET.

andylhxu commented 6 years ago

Ack. Thanks for following this up.

Sorry for not following this up on time. I will definitely try it out and report back asap 👍

basil-conto commented 6 years ago

Sorry for not following this up on time. I will definitely try it out and report back asap

No worries and good luck. :)