elisp and sockets
public text v1 · immutable;; A nice function to show off. Gets some HTTP headers.
(defun webinfo (host) (interactive "sHost: ")
(with-output-to-temp-buffer "*webinfo*"
(let ((s (open-network-stream (format "webinfo-%s" host) nil host "http")))
(when s
(unwind-protect
(progn
(set-process-filter s (lambda (o p) (princ (delete 13 p))))
(process-send-string s "HEAD / HTTP/1.0\r\n\r\n")
(while (eq (process-status s) 'open)
(sit-for 0.01)))
(delete-process s))))))