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

Returns a new instance of Chunker


164
165
166
167
# File 'lib/net/http/generic_request.rb', line 164

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

Instance Method Details

#finishObject


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

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

#write(buf) ⇒ Object


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

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