Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HTTP requests parsed in 4 lines of Lua.
local verb, resource, version, headers, body = data:match("(.+)%s+(.+)%s+(HTTP/%d%.?%d?)\r\n(.-)\r\n\r\n(.-)")
headers:gsub("(.-)%s*:%s*(.-)\r\n", function(name, value)
-- do something with name and value here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment