commit c91a5ca6a5c8c0a3ed2d2746017af29707e29397
parent 546217ca2ba01f96dc4bb7d88e7e47e667b61f5a
Author: Tomas Hlavaty <tom@logand.com>
Date:   Thu, 24 Oct 2013 01:07:42 +0200
fix http client
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/http.lisp b/http.lisp
@@ -137,14 +137,12 @@
 
 (defun client (url &key headers (redirect 5))
   (do (protocol code message headers2 body)
-      ((< (decf redirect) 0)
-       (unless (minusp redirect)
-         (list protocol code message headers2 body)))
+      ((< (decf redirect) 0))
     (multiple-value-setq (protocol code message headers2 body)
       (client1 url headers))
     (if (member code '(302))
         (setq url (cdr (assoc "Location" headers2 :test #'equal))) ;; TODO update "Host" header
-        (setq redirect 0))))
+        (return-from client (values protocol code message headers2 body)))))
 
 ;;(client "http://127.0.0.1:1234/")
 ;;(client "http://logand.com")