https://github.com/macournoyer/ruby_http_parser
Ruby bindings to Ryan Dahl's http-parser
https://github.com/macournoyer/ruby_http_parser
Last synced: about 1 year ago
JSON representation
Ruby bindings to Ryan Dahl's http-parser
- Host: GitHub
- URL: https://github.com/macournoyer/ruby_http_parser
- Owner: macournoyer
- Created: 2009-12-19T03:22:14.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-10-28T15:12:49.000Z (over 15 years ago)
- Last Synced: 2025-04-06T12:43:13.941Z (about 1 year ago)
- Language: C
- Homepage:
- Size: 109 KB
- Stars: 35
- Watchers: 2
- Forks: 49
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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