Skip to content

Commit

Permalink
Set "Leiningen" User-Agent in http requests for issue technomancy#636
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Adams committed Jun 13, 2012
1 parent 954249d commit d1b1ddc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions leiningen-core/src/leiningen/core/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ or by executing \"lein upgrade\". ")
(println "WARNING: task chaining has been moved to the \"do\" task.")
(println "See `lein help do` for details.")))

(defn- http-settings []
"Set Java system properties controlling HTTP request behavior."
(System/setProperty "aether.connector.userAgent" (str "Leiningen/" (leiningen-version)))
(when-let [{:keys [host port]} (classpath/get-proxy-settings)]
(System/setProperty "http.proxyHost" host)
(System/setProperty "http.proxyPort" (str port))))

(defn -main
"Run a task or comma-separated list of tasks."
[& [task-name & args]]
Expand All @@ -134,9 +141,7 @@ or by executing \"lein upgrade\". ")
task-name (lookup-alias task-name project)]
(when (:min-lein-version project)
(verify-min-version project))
(when-let [{:keys [host port]} (classpath/get-proxy-settings)]
(System/setProperty "http.proxyHost" host)
(System/setProperty "http.proxyPort" (str port)))
(http-settings)
(when-not project
(let [default-project (project/merge-profiles project/defaults [:user :default])]
(project/load-certificates default-project)
Expand Down

0 comments on commit d1b1ddc

Please sign in to comment.