Skip to content

Commit

Permalink
don't compress if there's already a Content-Encoding set
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejs committed Sep 14, 2010
1 parent 2f0f1ae commit e9ac1ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ring/middleware/gzip.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
(defn wrap-gzip [handler]
(fn [req]
(let [resp (handler req)]
(if (string? (resp :body))
(if (and (not ((resp :headers) "content-encoding"))
(string? (resp :body)))
(let [accepts (get (req :headers) "accept-encoding" "")
match (re-find #"(gzip|\*)(;q=((0|1)(.\d+)?))?" accepts)]
(if (and match (not (contains? #{"0" "0.0" "0.00" "0.000"}
Expand Down

0 comments on commit e9ac1ed

Please sign in to comment.