Skip to content

Instantly share code, notes, and snippets.

@owainlewis
Last active October 18, 2024 05:44
Show Gist options
  • Save owainlewis/5de6b8767c1cd4f5b1f6 to your computer and use it in GitHub Desktop.
Save owainlewis/5de6b8767c1cd4f5b1f6 to your computer and use it in GitHub Desktop.
Using Emacs ERC behind a HTTP proxy
;; Connect to ERC using a HTTP proxy : (
;; *******************************************
(defvar http-proxy-host
"www-cache.reith.bbc.co.uk")
(defvar http-proxy-port 80)
;; Proxy handler
;; *******************************************
(defun open-http-proxy-stream
(name buffer host service &rest parameters)
(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))
;; Tell ERC to use our custom handler to connect through a proxy
;; *******************************************
(setq erc-server-connect-function
'open-http-proxy-stream)
;; M-x erc as normal and you're good to go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment