Returns an iterator over the pairs in str
local http_util = require "http.util"
for name, value in http_util.query_args("foo=bar&baz=qux") do
print(name, value)
end
--[[ prints:
"foo", "bar"
"baz", "qux"
]]Converts a dictionary (table with string keys) with string values to an encoded query string.
local http_util = require "http.util"
print(http_util.dict_to_query({foo = "bar"; baz = "qux"})) --> "baz=qux&foo=bar"Map from schemes (as strings) to default ports (as integers).
Splits an authority into host and port components.
If the authority has no port component, will attempt to use the default for the scheme.
local http_util = require "http.util"
print(http_util.split_authority("localhost:8000", "http")) --> "localhost", 8000
print(http_util.split_authority("example.com", "https")) --> "localhost", 443Joins the host and port to create a valid authority component.
Omits the port if it is the default for the scheme.
Returns the time in HTTP preferred date format (See RFC 7231 section 7.1.1.1)
time defaults to the current time
- If
stris a validtoken, return it as-is. - If
strwould be valid as aquoted-string, return the quoted version - Otherwise, returns
nil