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