incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1043081 - in /incubator/deltacloud/trunk/server: lib/deltacloud/helpers/blob_stream.rb server.rb
Date Tue, 07 Dec 2010 15:06:14 GMT
Author: mfojtik
Date: Tue Dec  7 15:06:14 2010
New Revision: 1043081

URL: http://svn.apache.org/viewvc?rev=1043081&view=rev
Log:
Added Content-Disposition header for blob, so client can identify
content that server is streaming

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/blob_stream.rb
    incubator/deltacloud/trunk/server/server.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/blob_stream.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/blob_stream.rb?rev=1043081&r1=1043080&r2=1043081&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/blob_stream.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/blob_stream.rb Tue Dec  7 15:06:14
2010
@@ -28,7 +28,11 @@ begin
       #the client guess and if they can't they SHOULD default to
       #'application/octet-stream' anyway as per:
       #http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2.1
-      EM.next_tick { env['async.callback'].call [200, {'Content-Type' => "#{params['content_type']}",
'Content-Length' => "#{params['content_length']}"}, body] }
+      EM.next_tick { env['async.callback'].call [200, {
+        'Content-Type' => "#{params['content_type']}",
+        'Content-Disposition' => params["content_disposition"],
+        'Content-Length' => "#{params['content_length']}"}, body] 
+      }
       #call the driver from here. the driver method yields for every chunk of blob it receives.
We then
       #use body.call to write that chunk as received.
       driver.blob_data(credentials, params[:bucket], params[:blob], params) {|chunk| body.call
["#{chunk}"]} #close blob_data block

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1043081&r1=1043080&r2=1043081&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Tue Dec  7 15:06:14 2010
@@ -516,6 +516,7 @@ get '/api/buckets/:bucket/:blob/content'
   @blob = driver.blob(credentials, { :id => params[:blob], 'bucket' => params[:bucket]})
   params['content_length'] = @blob.content_length
   params['content_type'] = @blob.content_type
+  params['content_disposition'] = "attachment; filename=#{@blob.id}"
   BlobStream.call(env, credentials, params)
 end
 



Mime
View raw message