Skip to content

Instantly share code, notes, and snippets.

@igkuz
Created February 3, 2014 13:41
Show Gist options
  • Select an option

  • Save igkuz/8783975 to your computer and use it in GitHub Desktop.

Select an option

Save igkuz/8783975 to your computer and use it in GitHub Desktop.
require 'net/http'
uri = URI('http://localhost:8080/')
req = Net::HTTP::Post.new uri
file = File.open('spec/test_files/small.mp4', 'r') do |file|
count = 0
range_size = 500
while(block = file.read(range_size)) do
req.range = (count*range_size +1..(count+1)*range_size)
req.body = block
p req
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment