Created
June 21, 2014 08:30
-
-
Save need12648430/0fb5825c4268b988166e to your computer and use it in GitHub Desktop.
HTTP requests parsed in 4 lines of Lua.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment