handle_request

in spec/integration/timeouts/request_timeout_spec.rb [39:67]


    def handle_request(req, sock)
      sock.print "HTTP/1.0 200 OK\r\n"
      sock.print "Content-Type: text/html\r\n"
      if req.start_with?('GET /timeout')
        
        
        
        
        
        
        
        
        
        
        sock.print "\r\n"

        puts 'Slowly sending response lines...'
        RESPONSE_DURATION.times do |i|
          sleep 1
          sock.print "no\r\n"
          puts "[#{i}] One... line... at... a... time... "
        end
      else
        root_page_payload = "#{ROOT_PAGE}\r\n"
        sock.print "Content-Length: #{root_page_payload.length}\r\n\r\n"
        sock.print root_page_payload
      end
    end