From cc44d42ff6382be9f5bca2054c6f6fca2606b691 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 21 Feb 2018 14:01:17 -0800 Subject: [PATCH] Improve the message when insecure HTTP repositories are detected. We can at least emit the URL of the repository and the path of the resource which was attempted. Fixes #2391. --- leiningen-core/src/leiningen/core/main.clj | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/leiningen-core/src/leiningen/core/main.clj b/leiningen-core/src/leiningen/core/main.clj index 69f6b05c..52c506b7 100644 --- a/leiningen-core/src/leiningen/core/main.clj +++ b/leiningen-core/src/leiningen/core/main.clj @@ -416,9 +416,22 @@ Get the latest version of Leiningen at https://leiningen.org or by executing (project/init-project))) (defn- insecure-http-abort [& _] - (abort "Tried to use insecure HTTP repository without TLS. -This is almost certainly a mistake; however in rare cases where it's -intentional please see `lein help faq` for details.")) + (let [repo (promise)] + (reify org.apache.maven.wagon.Wagon + (getRepository [this]) + (setTimeout [this _]) + (setInteractive [this _]) + (addTransferListener [this _]) + (^void connect [this + ^org.apache.maven.wagon.repository.Repository the-repo + ^org.apache.maven.wagon.authentication.AuthenticationInfo _ + ^org.apache.maven.wagon.proxy.ProxyInfoProvider _] + (deliver repo the-repo) nil) + (get [this resource _] + (abort "Tried to use insecure HTTP repository without TLS:\n" + (str (.getId @repo) ": " (.getUrl @repo) "\n " resource) "\n" + "\nThis is almost certainly a mistake; for details see" + "\nhttps://github.com/technomancy/leiningen/blob/master/doc/FAQ.md"))))) (defn -main "Command-line entry point."