Skip to content

Instantly share code, notes, and snippets.

@postmodern
Created October 17, 2022 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save postmodern/924538f4333fba16588cde44cec52083 to your computer and use it in GitHub Desktop.
Save postmodern/924538f4333fba16588cde44cec52083 to your computer and use it in GitHub Desktop.
Testing infinite responses with HEAD requests
#!/usr/bin/env ruby
require 'bundler/setup'
require 'sinatra/base'
class App < Sinatra::Base
get '/' do
[200, {}, ('A'..)]
end
end
App.run!(server: ARGV[0] || 'webrick')
source 'https://rubygems.org/'
gem 'sinatra', '~> 2.0'
gem 'webrick'
gem 'thin'
gem 'puma'
gem 'unicorn'
$ ./app.rb
$ curl --head http://localhost:4567/
HTTP/1.1 200 OK
Content-Type: text/html;charset=utf-8
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Server: WEBrick/1.7.0 (Ruby/3.1.2/2022-04-12)
Date: Mon, 17 Oct 2022 21:20:32 GMT
Content-Length: 0
Connection: Keep-Alive
$ ./app.rb thin
$ curl --head http://localhost:4567/
HTTP/1.1 200 OK
Content-Type: text/html;charset=utf-8
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Connection: close
Server: thin
$ ./app puma
Content-Type: text/html;charset=utf-8
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment