1 (defvar http-tunnel-host "firewallmachine")
2 (defvar http-tunnel-port 80)
4 (defun open-http-tunneled-connection (name buffer host service)
5 (let ((proc (open-network-stream name buffer http-tunnel-host http-tunnel-port))
7 (if (or (null proc) (not (memq (process-status proc) '(run open))))
8 (error "Could not open connection"))
9 (process-send-string proc (format (eval-when-compile
11 "CONNECT %s:%s HTTP/1.0\r\n"
12 "User-Agent: Emacs/%d.%d\r\n"
19 (while (and (memq (process-status proc) '(open run)) need-to-spin)
20 (accept-process-output proc 3)
21 (goto-char (point-min))
22 (if (re-search-forward "\r\n\r\n" nil t)
24 (delete-region (point-min) (match-end 0))
25 (setq need-to-spin nil)))
26 (goto-char (point-max))))
27 (if (not (memq (process-status proc) '(open run)))
28 (error "Could not open connection"))
31 (let ((socks-noproxy '(".*")))
32 (setq x (open-http-tunneled-connection "x" "x" "www.cs.indiana.edu" 80))
33 (process-send-string x "GET / HTTP/1.0\r\n\r\n"))