Class: Net::HTTPGenericRequest::Chunker
- Inherits:
-
Object
- Object
- Net::HTTPGenericRequest::Chunker
- Defined in:
- lib/net/http/generic_request.rb
Overview
:nodoc:
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(sock) ⇒ Chunker
constructor
A new instance of Chunker.
- #write(buf) ⇒ Object
Constructor Details
#initialize(sock) ⇒ Chunker
Returns a new instance of Chunker.
243 244 245 246 |
# File 'lib/net/http/generic_request.rb', line 243 def initialize(sock) @sock = sock @prev = nil end |
Instance Method Details
#finish ⇒ Object
255 256 257 |
# File '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/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 |