Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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
Something went wrong with that request. Please try again.