method
send_body_string
v1_9_2_180 -
Show latest stable
- Class:
WEBrick::HTTPResponse
send_body_string(socket)private
No documentation available.
# File lib/webrick/httpresponse.rb, line 279
def send_body_string(socket)
if @request_method == "HEAD"
# do nothing
elsif chunked?
remain = body ? @body.bytesize : 0
while buf = @body[@sent_size, @buffer_size]
break if buf.empty?
data = ""
data << format("%x", buf.bytesize) << CRLF
data << buf << CRLF
_write_data(socket, data)
@sent_size += buf.bytesize
end
_write_data(socket, "0#{CRLF}#{CRLF}")
else
if @body && @body.bytesize > 0
_write_data(socket, @body)
@sent_size = @body.bytesize
end
end
end