We don’t have HTTP proxy support for ERC, yet. But see below for some trivials ways of adding it yourself.
Here’s some background material:
Khmar thinks socks is easier.
aadis says to look how irc-via-proxy is done in the gaim code.
alephnull says: You could run desproxy-socksserver on localhost and tunnel through your HTTP proxy.
socks.el comes with Emacs. (Emacs 22 and older can get it from w3.) If you set ‘socks-override-functions’ before loading the library, all the network functions will be using socks:
(setq socks-override-functions 1) (setq socks-noproxy '("localhost")) (require 'socks)
Alternatively, you can use the following for ERC only:
(setq socks-noproxy '("localhost")) (require 'socks) (setq erc-server-connect-function 'socks-open-network-stream)
The location of the socks server is in the variable ‘socks-server’. To set it you can do:
(setq socks-server (list "My socks server" "socks-server-hostname" 1080 5))
Where “My socks server” is the description of the server, “socks-server-hostname” is the host name for the server, 1080 is the port, and 5 is the socks version (can be 4 as well)
‘socks-noproxy’ holds a list of regexps for which the network calls are not socksified. I’ve excluded localhost from the connections so that I can still connect to BitlBee.
To use ERC with Tor requires you to have Privoxy installed and configured, as well as the socks.el code from above. In addition, you need to set socks-server with M-x customize-variable RET socks-server RET.
Set the server to “localhost” if you are running Tor/Privoxy on the localhost, or set it to the server where Tor/Privoxy is running. Set the port to “9050”, and select the “Socks v5” radio button.
offby1 just discovered that torify emacs, followed by M-x erc-select, works fine.
Does this solutions leak dns?
Instead of desproxy, I use corkscrew to tunnel IRC connections through HTTP proxies. Here’s what I do:
(defun corkscrew-open-network-stream (name buffer host service) "Opens a network stream via corkscrew" (open-network-stream name buffer host service :type 'shell :shell-command "corkscrew <proxyhost> <proxyport> %s %p"))
(let ((erc-server-connect-function open-network-stream)) (erc :server "chat.freenode.net"))
Of course, you want to install corkscrew first. --sthuebner
You can use the following to use an unauthenticated HTTP proxy for ERC without external tools:
(defvar http-proxy-host <proxyhost> "Host address for http proxy") (defvar http-proxy-port <proxyport> "Host port for http proxy")
(defun open-http-proxy-stream (name buffer host service &rest parameters) "Open network stream via http proxy. Proxy is defined by variables http-proxy-host and http-proxy-port." (let ((tmp-process (apply 'open-network-stream name buffer http-proxy-host http-proxy-port parameters))) (process-send-string name (format "CONNECT %s:%d HTTP/1.1\n\n" host service)) tmp-process))
(setq erc-server-connect-function 'open-http-proxy-stream)
--blorbx