Skip to content
A pure Ruby HTTP Server.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
benchmarks chmod +x'ed server.rb. May 22, 2011
lib Simplify. Mar 10, 2013
spec We have spec/images hosted in a different directory. May 8, 2015
.document Initial commit. Jan 16, 2011
.gitignore Added a Gemfile. May 8, 2015
.rspec Initial commit. Jan 17, 2011
.yardopts Initial commit. Jan 17, 2011
ChangeLog.md Updated the ChangeLog for 0.2.2. Sep 8, 2012
Gemfile Require rack for specs. May 8, 2015
LICENSE.txt Initial commit. Jan 17, 2011
README.md Explicitly require gserver since it was removed from stdlib. May 8, 2015
Rakefile Require bundler. May 8, 2015
gemspec.yml Added a Gemfile. May 8, 2015
net-http-server.gemspec

README.md

net-http-server

Description

{Net::HTTP::Server} is a pure Ruby HTTP server.

Features

  • Pure Ruby.
  • Supports Streamed Request/Response Bodies.
  • Supports Chunked Transfer-Encoding.
  • Provides a Rack Handler.

Examples

Simple HTTP Server:

require 'net/http/server'
require 'pp'

Net::HTTP::Server.run(:port => 8080) do |request,stream|
  pp request

  [200, {'Content-Type' => 'text/html'}, ['Hello World']]
end

Use it with Rack:

require 'rack/handler/http'

Rack::Handler::HTTP.run app

Using it with rackup:

$ rackup -s HTTP

Requirements

Install

$ gem install net-http-server

Copyright

Copyright (c) 2011 Hal Brodigan

See {file:LICENSE.txt} for details.

Something went wrong with that request. Please try again.