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.
166 167 168 169 |
# File 'lib/net/http/generic_request.rb', line 166 def initialize(sock) @sock = sock @prev = nil end |
Instance Method Details
#finish ⇒ Object
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 |