Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Code cleanup. Successfully working with Cyberduck now.

  • Loading branch information...
commit aa6d8a4313228d20a39ab7764b60a35bb0699f09 1 parent f15c8e0
razerbeans authored
View
2  lib/boardwalk/control_routes.rb
@@ -70,7 +70,7 @@
end
tempf = Tempfile.new("#{slot.file_name}")
tempf.puts slot.bit.data
- send_file(tempf.path, {:disposition => 'attachment', :filename => slot.file_name, :type => slot.bit_type})
+ send_file(tempf.path, {:disposition => 'attachment', :filename => slot.file_name, :type => slot.bit_type, :length => slot.bit_size})
tempf.close!
status 200
end
View
2  lib/boardwalk/helpers.rb
@@ -14,7 +14,7 @@ def aws_authenticate
@amz.sort.each do |k, v|
canonical[-1,0] = "x-amz-#{k}:#{v}"
end
- # puts "Environment info: " + @env.inspect
+ # puts "\e[1;32mEnvironment info:\e[0m" + @env.inspect
@user = User.first(:conditions => {:s3key => key})
if @user and secret != hmac_sha1(@user.s3secret, canonical.map{|v|v.to_s.strip} * "\n")
raise BadAuthentication
View
9 lib/boardwalk/s3_routes.rb
@@ -69,8 +69,9 @@
aws_authenticate
bucket = @user.buckets.to_enum.find{|b| b.name == params[:captures][0]}
slot = bucket.slots.to_enum.find{|s| s.file_name == params[:captures][1]}
+ # puts "\e[1;32mBit size:\e[0m " + slot.bit_size.to_s
aws_only_can_read slot
-
+
since = Time.httpdate(request.env['HTTP_IF_MODIFIED_SINCE']) rescue nil
if since && (slot.bit.upload_date) <= since
raise NotModified
@@ -82,14 +83,10 @@
if request.env['HTTP_IF_NONE_MATCH'] && (slot.md5 == request.env['HTTP_IF_NONE_MATCH'])
raise NotModified
end
- if request.env['HTTP_RANGE']
- raise NotImplemented
- end
tempf = Tempfile.new("#{slot.file_name}")
tempf.puts slot.bit.data
- send_file(tempf.path, {:disposition => 'attachment', :filename => slot.file_name, :type => slot.bit_type})
+ send_file(tempf.path, {:disposition => 'attachment', :filename => slot.file_name, :type => slot.bit_type, :length => slot.bit_size})
tempf.close!
- status 200
end
get %r{/([^\/]+)/?} do |e|
Please sign in to comment.
Something went wrong with that request. Please try again.