使用Ruby流二進制數據到服務器,我只是嘗試解析流文件到服務器,我有badrequst HTTP問題。任何人都可以幫助我通過使用Net :: HTTP將數據發送到服務器。使用網:: HTTP紅寶石
def addbitstream(url, path, file_bitstream)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(path)
f = File.new(file_bitstream)
file = File.open(f)
n = 6
offset = 0
request.body = ""
while (offset < File.size(file))
buffer = readfileAsbitstream(file, offset, n)
request.body = buffer
response = Net::HTTP.start(uri.host, 443) {|http| http.request(request) }
offset += n
end
end
感謝你的建議,你有過將數據發送到服務器的任何想法,我想通過NET :: HTTP每塊發送到服務器? – MHP 2013-04-11 16:37:16