From 2a6ad888d0bdde7c5a69243d654a33822266bdb6 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 17 Apr 2015 21:37:21 +0200 Subject: [PATCH] Implement basic HTTP status checking in fetch method. --- src/utils/archive.lisp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/archive.lisp b/src/utils/archive.lisp index 163ad67..621190e 100644 --- a/src/utils/archive.lisp +++ b/src/utils/archive.lisp @@ -29,8 +29,12 @@ should-close status) (drakma:http-request url :force-binary t :want-stream t) - ;; TODO: check the status-code - (declare (ignore status-code uri stream status)) + (declare (ignore uri stream)) + + (when (not (= 200 status-code)) + (log-message :fatal "HTTP Error ~a: ~a" status-code status) + (error status)) + (let* ((source-stream (flexi-streams:flexi-stream-stream http-stream)) (content-length (parse-integer (cdr (assoc :content-length headers)))))