diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-12 13:38:09 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-12 13:38:09 -0800 |
commit | f5eae25bad81afcd0e0c11f671a7fa7e12461015 (patch) | |
tree | 65a7ae52d370050ce251b501211636b8b7d4c263 | |
parent | f301f399937f9ff62dc41a9cd8e1ea45b43baa6b (diff) | |
download | upr-f5eae25bad81afcd0e0c11f671a7fa7e12461015.tar.gz |
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.
-rw-r--r-- | lib/upr/input_wrapper.rb | 4 |
1 files 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 |