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.
160 161 162 163 |
# File 'lib/net/http/generic_request.rb', line 160 def initialize(sock) @sock = sock @prev = nil end |
Instance Method Details
#finish ⇒ Object
173 174 175 |
# File 'lib/net/http/generic_request.rb', line 173 def finish @sock.write("0\r\n\r\n") end |
#write(buf) ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/net/http/generic_request.rb', line 165 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 |