Last active
October 18, 2024 05:44
-
-
Save owainlewis/5de6b8767c1cd4f5b1f6 to your computer and use it in GitHub Desktop.
Using Emacs ERC behind a HTTP proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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