Commit e695fdd1 authored by Eric Timmons's avatar Eric Timmons
Browse files

Fix HTTP object store handling of 404s

404s weren't previously caught when a HEAD was bypassed. Additionally, ensure
the stream gets closed on errors to prevent fd leaks.
parent f42bf48a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -92,8 +92,18 @@
                             :additional-headers headers
                             :want-stream t
                             :force-binary binary-p)
      (when (>= code 400)
      (when (= code 404)
        (ecase if-does-not-exist
          ((nil)
           (signal 'object-missing :store object-store :path path)
           (close s)
           (return-from open-object-stream nil))
          (:error
           (close s)
           (cerror "Continue" 'object-missing :store object-store :path path))))
      (when (and (>= code 400) (/= code 404))
        ;; Something funky has happened..
        (close s)
        (error "Unknown error!"))
      (when (and offset (not (equal accept-ranges "bytes")))
        ;; Server doesn't support requesting ranges. We have to forward the