Skip to content

don't fail when an http url redirects to an https url #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions upstream-http.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
(defmethod create-source-cache ((source http-source))
(let ((cached (cache-object-file source)))
(ensure-directories-exist cached)
(fetch (location source) cached)
(fetch-http-or-https (location source) cached)
(probe-file cached)))

(defclass http-bz2-source (http-source) ())
Expand All @@ -73,7 +73,7 @@
(let ((cached (cache-object-file source)))
(ensure-directories-exist cached)
(in-temporary-directory "bz2/"
(fetch (location source) "temp.bz2")
(fetch-http-or-https (location source) "temp.bz2")
(with-binary-run-output "temp.dat"
(run "bunzip2" "-c" "temp.bz2"))
(run "gzip" "temp.dat")
Expand Down Expand Up @@ -102,7 +102,7 @@
(name (project-name source)))
(ensure-directories-exist cached)
(in-temporary-directory (format nil "~A/" name)
(fetch (location source) "naked.tgz")
(fetch-http-or-https (location source) "naked.tgz")
(sb-posix:mkdir name #o755)
(with-posix-cwd name
(run "tar" "xzvf" "../naked.tgz"))
Expand All @@ -117,3 +117,9 @@
(ensure-directories-exist cached)
(curl (location source) cached)
(probe-file cached)))

(defun fetch-http-or-https (loc file)
(handler-case
(fetch loc file)
(ql-http:https-redirect ()
(curl loc file))))