[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: am I stupid? I crashed my Mac 10 times with 9 lines of code.



In article <PHILG.94Aug18131743@camelot.ai.mit.edu>, philg@mit.edu wrote:

> Remember I said I wanted a function to go out to the network and grab
4the following gets the same as my unix box

(require 'mactcp)

(defun get-http-url (hostname filename)
  (let ((stream (open-tcp-stream hostname 80))
        result
        )
    (unwind-protect
      (progn
        (ccl::telnet-write-line stream (format nil "GET ~a HTTP/1.0" filename))
        (ccl::telnet-write-line stream "")
        (setq result (ccl::telnet-read-line stream)))
      (close stream))
    result))

#|
(get-http-url "www-swiss.ai.mit.edu" "/")
|#