Skip to content
Ruby bindings to Ryan Dahl's http-parser
C Ruby
Find file
Failed to load latest commit information.
bench Add some benchmark script. Dec 20, 2009
ext Initial commit Dec 18, 2009
lib/net/http Remove compiled .bundle Dec 18, 2009
spec Initial commit Dec 19, 2009
.gitignore Add gemspec Mar 7, 2010
README.md Add note regarding better fork. Oct 28, 2010
Rakefile Initial commit Dec 19, 2009
ruby_http_parser.gemspec Add gemspec Mar 7, 2010

README.md

UNMAINTAINED!

I don't work on this anymore. See this awesome fork instead: http://github.com/tmm1/http_parser.rb/

And have a nice day, please!

Ruby bindings to Ryan Dahl's http-parser

Ruby bindings to http://github.com/ry/http-parser

Usage

require "net/http/parser"

parser = Net::HTTP::RequestParser.new

parser.on_headers_complete = proc do |env|
  # Rack formatted env hash
  p env
end

parser.on_body = proc do |chunk|
  # One chunk of the body
  p chunk
end

parser.on_message_complete = proc do |env|
  # Headers and body is all parsed
  puts "Done!"
end

# Feed raw data from the socket to the parser
parser << raw_data
Something went wrong with that request. Please try again.