From f5eae25bad81afcd0e0c11f671a7fa7e12461015 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 12 Nov 2009 13:38:09 -0800 Subject: input_wrapper: don't wrap if we don't have to Clients _must_ will either specify the Content-Length header _or_ "Transfer-Encoding: chunked". This will work around clients that seem to send POST requests with no body at all in them. --- lib/upr/input_wrapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/upr/input_wrapper.rb b/lib/upr/input_wrapper.rb index 5268498..7c7a0d9 100644 --- a/lib/upr/input_wrapper.rb +++ b/lib/upr/input_wrapper.rb @@ -38,8 +38,8 @@ module Upr /\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ] length = env["CONTENT_LENGTH"] and length = length.to_i - env["TRANSFER_ENCODING"] =~ %r{\Achunked\z}i and length = nil - if length.nil? || length > 0 + chunked = env["TRANSFER_ENCODING"] =~ %r{\Achunked\z}i and length = nil + if chunked || (length && length > 0) if uid = extract_upload_id(env) return dup._call(env, uid, length) end -- cgit v1.2.3-24-ge0c7