Skip to content
Lua HTTP parser
Branch: master
Clone or download
Pull request Compare This branch is 9 commits ahead of armatys:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
LICENSE
README.markdown
hyperparser-1.3-1.rockspec

README.markdown

Hyperparser - Lua HTTP parser (based on http-parser)

It runs on *BSD and Linux. Windows was not tested.

Compilation

Use luarocks to compile and install:

$ [sudo] luarocks make

Usage:

The library follows behavior from http-parser C library.

require "hyperparser"

local parser = hyperparser.new("request") -- or hyperparser.new("response")
local req = "GET /index/?key=val&key2=val2 HTTP/1.1\r\nHost: www.example.com\r\nContent-Length: 9\r\n\r\n"

local settings = {
    msgcomplete = function()
        print("Message completed.")
    end,
   
    headerfield = function(a)
        io.write(a)
	end,
	
	headervalue = function(a)
		io.write(" -> " .. a .. "\n")
	end
}

local nread, err = parser:execute(settings, req)
    if err then
        -- handle error
    end

Origin

from https://github.com/armatys/hyperparser

You can’t perform that action at this time.