Ruby FFI bindings to the http-parser library.
MIT License
Ruby FFI bindings to the Joyent's http-parser (1.0) library.
require 'ffi/http/parser'
parser = FFI::HTTP::Parser.new do |parser|
parser.on_message_begin do
puts "message begin"
end
parser.on_message_complete do
puts "message end"
end
parser.on_url do |data|
puts "url: #{data}"
end
parser.on_header_field do |data|
puts "field: #{data}"
end
parser.on_header_value do |data|
puts "value: #{data}"
end
parser.on_body do |data|
puts "body: #{data}"
end
end
$ gem install ffi-http-parser
Debian / Ubuntu:
$ sudo apt install libhttp-parser-dev
RedHat / Fedora:
$ sudo dnf install http-parser-devel
macOS:
$ brew install http-parser
Copyright (c) 2012 Hal Brodigan
See {file:LICENSE.txt} for details.