class Excon::Connection
def detect_content_length(body)
def detect_content_length(body) if body.is_a?(String) if FORCE_ENC body.force_encoding('BINARY') end body.length elsif body.respond_to?(:size) # IO object: File, Tempfile, etc. body.size else begin File.size(body) # for 1.8.7 where file does not have size rescue 0 end end end