about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-12-06 17:06:08 -0800
committerEric Wong <normalperson@yhbt.net>2011-12-06 17:06:08 -0800
commit11ee57e7aaa8766d13e29d3872bd78d50a3e5263 (patch)
tree5722aec658842c06d5cc8246e79cbfa2ebdba83f
parentd74fad403f23c1ee36b9fbf276d12b12ef5d92d1 (diff)
downloadmogilefs-client-11ee57e7aaa8766d13e29d3872bd78d50a3e5263.tar.gz
We won't force this onto the wire for trackers until upstream
MogileFS decides to support it.
-rw-r--r--lib/mogilefs/http_file.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/mogilefs/http_file.rb b/lib/mogilefs/http_file.rb
index b8bfd48..1c8acd7 100644
--- a/lib/mogilefs/http_file.rb
+++ b/lib/mogilefs/http_file.rb
@@ -177,13 +177,18 @@ class MogileFS::HTTPFile < StringIO
       :size => bytes_uploaded,
       :path => uri.to_s,
     }
-    if @md5
-      args[:checksum] = "MD5:#{@md5.hexdigest}"
-    elsif String === @opts[:content_md5]
-      hex = @opts[:content_md5].unpack('m')[0].unpack('H*')[0]
-      args[:checksum] = "MD5:#{hex}"
+
+    # checksums are not yet supported in upstream MogileFS as of 2011-12-06
+    if @opts[:MD5]
+      if @md5
+        args[:checksum] = "MD5:#{@md5.hexdigest}"
+      elsif String === @opts[:content_md5]
+        hex = @opts[:content_md5].unpack('m')[0].unpack('H*')[0]
+        args[:checksum] = "MD5:#{hex}"
+      end
+      args[:checksumverify] = 1 if @opts[:checksumverify]
     end
-    args[:checksumverify] = 1 if @opts[:checksumverify]
+
     @opts[:backend].create_close(args)
     bytes_uploaded
   end