Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby FFI bindings to the http-parser library.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .yardopts
Octocat-spinner-32 ChangeLog.md
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 ffi-http-parser.gemspec
Octocat-spinner-32 gemspec.yml
README.md

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

Copyright

Copyright (c) 2012 Hal Brodigan

See {file:LICENSE.txt} for details.

Something went wrong with that request. Please try again.