tree: 60cfda2f6adc30783ddfaa3f548569504edd555a [search]
  1. .commit/
  2. ext/
  3. lib/
  4. .rspec
  5. CHANGELOG.md
  6. Gemfile
  7. LICENSE
  8. llhttp-ffi.gemspec
  9. Rakefile
  10. README.md
ffi/README.md

llhttp-ffi

Ruby FFI bindings for llhttp.

Install

gem install llhttp-ffi

Usage

require "llhttp"

# Define a delegate class for handling callbacks:
#
class Delegate < LLHttp::Delegate
  def on_message_begin
    ...
  end
end

delegate = Delegate.new

# Create a parser:
#
parser = LLHttp::Parser.new(delegate)

# Parse a request:
#
parser << "GET / HTTP/1.1\r\n\r\n"

# Reset the parser for the next request:
#
parser.reset