Class: Gem::Net::HTTPGenericRequest::Chunker

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(sock) ⇒ Chunker

Returns a new instance of Chunker.



243
244
245
246
# File 'lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb', line 243

def initialize(sock)
  @sock = sock
  @prev = nil
end

Instance Method Details

#finishObject



255
256
257
# File 'lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb', line 255

def finish
  @sock.write("0\r\n\r\n")
end

#write(buf) ⇒ Object



248
249
250
251
252
253
# File 'lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb', line 248

def write(buf)
  # avoid memcpy() of buf, buf can huge and eat memory bandwidth
  rv = buf.bytesize
  @sock.write("#{rv.to_s(16)}\r\n", buf, "\r\n")
  rv
end