0.0
No commit activity in last 3 years
No release in over 3 years
Ruby FFI bindings to the http-parser library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.4
~> 0.7

Runtime

~> 1.0
 Project Readme

ffi-http-parser

Description

Ruby FFI bindings to the Joyent's http-parser (1.0) library.

Features

  • Provides the same API as http-parser-lite.
  • Supports:
    • Ruby 1.8.7
    • Ruby >= 1.9.1
    • JRuby >= 1.6.7

Examples

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

Requirements

Install

$ gem install ffi-http-parser

libhttp-parser

  • Debian / Ubuntu:

    $ sudo apt install libhttp-parser-dev
    
  • RedHat / Fedora:

    $ sudo dnf install http-parser-devel
    
  • macOS:

    $ brew install http-parser
    

Copyright

Copyright (c) 2012 Hal Brodigan

See {file:LICENSE.txt} for details.