Class: Net::HTTPGenericRequest::Chunker

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(sock) ⇒ Chunker


166
167
168
169
# File 'lib/net/http/generic_request.rb', line 166

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

Instance Method Details

#finishObject


178
179
180
# File 'lib/net/http/generic_request.rb', line 178

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

#write(buf) ⇒ Object


171
172
173
174
175
176
# File 'lib/net/http/generic_request.rb', line 171

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