lib/http/request/writer.rb
# CRLF is the universal HTTP delimiter
CRLF is the universal HTTP delimiter
CRLF is the universal HTTP delimiter
def send_request
        headers = join_headers
        case @body
        when NilClass
          write(headers)
        when String
          write(headers << @body)
        when Enumerable
          write(headers)
          @body.each do |chunk|
            write(chunk.bytesize.to_s(16) << CRLF << chunk << CRLF)
          end
          write(CHUNKED_END)
        else raise TypeError, "invalid body type: #{@body.class}"
        end
      end
def send_request headers = join_headers case @body when NilClass write ( headers ) when String write ( headers << @body ) when Enumerable write ( headers ) @body . each do | chunk | write ( chunk . bytesize . to_s ( 16 ) << CRLF << chunk << CRLF ) end write ( CHUNKED_END ) else raise TypeError , "invalid body type: #{@body.class}" end end
CRLF is the universal HTTP delimiter
CRLF is the universal HTTP delimiter
# It's important to send the request in a single write call when # possible in order to play nicely with Nagle's algorithm. Making # two writes in a row triggers a pathological case where Nagle is # expecting a third write that never happens.