diff options
Diffstat (limited to 'lib/upr/input_wrapper.rb')
-rw-r--r-- | lib/upr/input_wrapper.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/upr/input_wrapper.rb b/lib/upr/input_wrapper.rb index 2070d38..5268498 100644 --- a/lib/upr/input_wrapper.rb +++ b/lib/upr/input_wrapper.rb @@ -9,6 +9,8 @@ module Upr :input, :pos, :seen, :content_length, :upload_id, :mtime) + include Params + def initialize(app, options = {}) super(app, Array(options[:path_info] || nil), @@ -38,12 +40,7 @@ module Upr length = env["CONTENT_LENGTH"] and length = length.to_i env["TRANSFER_ENCODING"] =~ %r{\Achunked\z}i and length = nil if length.nil? || length > 0 - req = Rack::Request.new(env) - - # can't blindly parse params here since we don't want to read - # the POST body if there is one, so only parse stuff in the - # query string... - if uid = req.GET["upload_id"] + if uid = extract_upload_id(env) return dup._call(env, uid, length) end end @@ -52,7 +49,7 @@ module Upr end def _call(env, uid, length) - self.upload_id = env["upr.upload_id"] = uid + self.upload_id = uid self.mtime = self.pos = self.seen = 0 self.input = env["rack.input"] env["rack.input"] = self |