X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=contrib%2Fasdf-install%2Finstaller.lisp;h=3672523fdba6cc57fbb1de1bb6a2ab2b47b13761;hb=58ef9d8996d4421610101b52e5a25fd2c70c4792;hp=0f5b1f153e4209027ce928f4f10a826596854536;hpb=1f7be74ab9c2117e236b9ff359764393271f98ac;p=sbcl.git diff --git a/contrib/asdf-install/installer.lisp b/contrib/asdf-install/installer.lisp index 0f5b1f1..3672523 100644 --- a/contrib/asdf-install/installer.lisp +++ b/contrib/asdf-install/installer.lisp @@ -101,39 +101,50 @@ (let ((port-start (position #\: url :start 7))) (if port-start (parse-integer url :start (1+ port-start) :junk-allowed t) 80))) +(defun request-uri (url) + (assert (string-equal url "http://" :end1 7)) + (if *proxy* + url + (let ((path-start (position #\/ url :start 7))) + (subseq url path-start)))) + (defun url-connection (url) (let ((s (make-instance 'inet-socket :type :stream :protocol :tcp)) (host (url-host url)) (port (url-port url)) - result) + result) (declare (ignore port)) (unwind-protect - (progn - (socket-connect - s (car (host-ent-addresses (get-host-by-name (url-host (or *proxy* url))))) - (url-port (or *proxy* url))) - (let ((stream (socket-make-stream s :input t :output t :buffering :full :external-format :iso-8859-1))) - ;; we are exceedingly unportable about proper line-endings here. - ;; Anyone wishing to run this under non-SBCL should take especial care - (format stream "GET ~A HTTP/1.0~c~%Host: ~A~c~%Cookie: CCLAN-SITE=~A~c~%~c~%" - url #\Return host #\Return *cclan-mirror* #\Return #\Return) - (force-output stream) - (setf result - (list - (let* ((l (read-line stream)) - (space (position #\Space l))) - (parse-integer l :start (1+ space) :junk-allowed t)) - (loop for line = (read-line stream nil nil) - until (or (null line) (eql (elt line 0) (code-char 13))) - collect - (let ((colon (position #\: line))) - (cons (intern (string-upcase (subseq line 0 colon)) :keyword) - (string-trim (list #\Space (code-char 13)) - (subseq line (1+ colon)))))) - stream)))) + (progn + (socket-connect + s (car (host-ent-addresses (get-host-by-name (url-host (or *proxy* url))))) + (url-port (or *proxy* url))) + (let ((stream (socket-make-stream s :input t :output t :buffering :full :external-format :iso-8859-1))) + ;; we are exceedingly unportable about proper line-endings here. + ;; Anyone wishing to run this under non-SBCL should take especial care + (format stream "GET ~A HTTP/1.0~c~%~ + Host: ~A~c~%~ + Cookie: CCLAN-SITE=~A~c~%~c~%" + (request-uri url) #\Return + host #\Return + *cclan-mirror* #\Return #\Return) + (force-output stream) + (setf result + (list + (let* ((l (read-line stream)) + (space (position #\Space l))) + (parse-integer l :start (1+ space) :junk-allowed t)) + (loop for line = (read-line stream nil nil) + until (or (null line) (eql (elt line 0) (code-char 13))) + collect + (let ((colon (position #\: line))) + (cons (intern (string-upcase (subseq line 0 colon)) :keyword) + (string-trim (list #\Space (code-char 13)) + (subseq line (1+ colon)))))) + stream)))) (when (and (null result) - (socket-open-p s)) - (socket-close s))))) + (socket-open-p s)) + (socket-close s))))) (defun download-files-for-package (package-name-or-url file-name) (let ((url