Skip to content
C Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mrblib
src
test
.gitignore
.travis.yml
LICENSE
README.md
Rakefile
build_config.rb
mrbgem.rake

README.md

mruby-phr

A small http parser for mruby based on https://github.com/h2o/picohttpparser

Build Status Example

buffer = "HTTP/1.1 200 OK\r\nContent-Length: 5\r\nConnection: close\r\n\r\nhallo"

phr = Phr.new
offset = phr.parse_response buffer
puts phr.minor_version
puts phr.status
puts phr.msg
puts phr.headers
body = buffer[offset..-1]
puts body
phr.reset

buffer = "POST / HTTP/1.1\r\nHost: www.google.com\r\nContent-Length: 5\r\nConnection: close\r\n\r\nhallo"
offset = phr.parse_request buffer
puts phr.method
puts phr.path
puts phr.minor_version
puts phr.headers
body = buffer[offset..-1]
puts body
phr.reset

buffer = "b\r\nhello world\r\n0\r\n"
phr.decode_chunked(buffer)
puts buffer
phr.reset
You can’t perform that action at this time.