Sha256: 0f27828efecff6bd3262cd44fbc5eb665da20f90a3304ad58a374d2736bb066c

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

require "uricp/version"
require "uricp/curl_primitives"
require "uricp/orbit_auth"
require "uricp/segmenter"

module Uricp

  UnsupportedURLtype = Class.new(ArgumentError)

end

#Monkey patch a copy_stream facility in using 'sendfile'
unless IO.respond_to? :copy_stream
  require 'sendfile'

  def IO.copy_stream(src, dst, copy_length=nil, offset=nil)
    unless src.stat.pipe?
      current_pos = src.pos
      count = dst.sendfile(src, offset || current_pos, copy_length)
      src.seek(count, IO::SEEK_CUR)
      return count
    else
      amount = copy_length.to_i
      buf_size = 2**16
      buffer=""
      while amount > 0 do
	src.read(buf_size, buffer)
	amount_read = buffer.length
	dst.write(buffer)
	amount -= amount_read
	break if src.eof?
      end
      return copy_length.to_i - amount
    end
  rescue EOFError
    0
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uricp-0.0.6 lib/segment_upload.rb
uricp-0.0.5 lib/segment_upload.rb
uricp-0.0.4 lib/segment_upload.rb
uricp-0.0.3 lib/segment_upload.rb
uricp-0.0.2 lib/segment_upload.rb
uricp-0.0.1 lib/segment_upload.rb