Skip to content

Commit

Permalink
Set user-agent in search index downloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jun 13, 2012
1 parent d8d5ca1 commit 50f9310
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/leiningen/search.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[leiningen.core.project :as project]
[leiningen.core.main :as main]
[clucy.core :as clucy]
[clj-http.client :as client])
[clj-http.client :as http])
(:import (java.util.zip ZipFile)
(java.net URL)
(java.io File InputStream OutputStream FileOutputStream)))
Expand All @@ -28,7 +28,8 @@
(URL. (format "%s/.index/nexus-maven-repository-index.zip" url)))

(defn- download [^URL url ^OutputStream out-stream & {:keys [callback]}]
(let [resp (client/get (str url) {:as :stream})
(let [resp (http/get (str url) {:as :stream
:headers {"User-Agent" (main/user-agent)}})
content-len (try (Long/valueOf
(get-in resp [:headers "content-length"]))
(catch Exception _))
Expand Down

0 comments on commit 50f9310

Please sign in to comment.