Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
[prismatic/schema "1.4.1"]
[riddley "0.2.0"]
[ring/ring-codec "1.3.0"]
[ring/ring-core "1.8.2"]
[ring/ring-core "1.15.3"]
[ring/ring-mock "0.6.2"]
[robert/hooke "1.3.0"]
[timofreiberg/bultitude "0.3.1"]
Expand Down
11 changes: 7 additions & 4 deletions src/puppetlabs/puppetdb/http/command.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(:import
(clojure.lang ExceptionInfo)
(java.net HttpURLConnection)
(org.apache.commons.fileupload.util LimitedInputStream)))
(org.apache.commons.io.input BoundedInputStream)))

(def min-supported-commands
{"configure expiration" 1
Expand Down Expand Up @@ -124,13 +124,16 @@
;; The drain is because ruby. i.e. if we closed the connection
;; without that, one of the ruby clients wouldn't handle the broken
;; pipe in a friendly way.
(proxy [LimitedInputStream] [stream max-size]
(raiseError [max-size count]
;;
;; Override onMaxLength which is called when
;; the max count is reached during a read operation.
(proxy [BoundedInputStream] [stream max-size]
(onMaxLength [max-count read-count]
;; We don't trust skip; it appears to just invoke InputStream
;; skip which claims to allocate at least one buffer (of
;; unspecified size) per request.
(loop [buf (byte-array (* 64 1024))]
(when (pos? (.read ^java.io.InputStream this buf))
(when (pos? (.read ^java.io.InputStream stream buf))
(recur buf)))
(throw (ex-info "" {:kind ::body-stream-overflow})))))

Expand Down
Loading