def send_body_io(socket)
      begin
        if @request_method == "HEAD"
          # do nothing
        elsif chunked?
          begin
            buf  = ''
            data = ''
            while true
              @body.readpartial( @buffer_size, buf ) # there is no need to clear buf?
              data << format("%x", buf.bytesize) << CRLF
              data << buf << CRLF
              _write_data(socket, data)
              data.clear
              @sent_size += buf.bytesize
            end
          rescue EOFError # do nothing
          end
          _write_data(socket, "0#{CRLF}#{CRLF}")
        else
          size = @header['content-length'].to_i
          _send_file(socket, @body, 0, size)
          @sent_size = size
        end
      ensure
        @body.close
      end
    end
def send_body_io(socket)
      begin
        if @request_method == "HEAD"
          # do nothing
        elsif chunked?
          begin
            buf  = ''
            data = ''
            while true
              @body.readpartial( @buffer_size, buf ) # there is no need to clear buf?
              data << format("%x", buf.bytesize) << CRLF
              data << buf << CRLF
              _write_data(socket, data)
              data.clear
              @sent_size += buf.bytesize
            end
          rescue EOFError # do nothing
          end
          _write_data(socket, "0#{CRLF}#{CRLF}")
        else
          size = @header['content-length'].to_i
          _send_file(socket, @body, 0, size)
          @sent_size = size
        end
      ensure
        @body.close
      end
    end
:stopdoc: