method
send_request_with_body_stream
v2_2_9 -
Show latest stable
- Class:
Net::HTTPGenericRequest
send_request_with_body_stream(sock, ver, path, f)private
No documentation available.
# File lib/net/http/generic_request.rb, line 190
def send_request_with_body_stream(sock, ver, path, f)
unless content_length() or chunked?
raise ArgumentError,
"Content-Length not given and Transfer-Encoding is not `chunked'"
end
supply_default_content_type
write_header sock, ver, path
wait_for_continue sock, ver if sock.continue_timeout
if chunked?
chunker = Chunker.new(sock)
IO.copy_stream(f, chunker)
chunker.finish
else
# copy_stream can sendfile() to sock.io unless we use SSL.
# If sock.io is an SSLSocket, copy_stream will hit SSL_write()
IO.copy_stream(f, sock.io)
end
end