chore(url)!: Remove params parsing, part of deprecated URL schema

This commit is contained in:
Caleb Maclennan 2023-11-09 14:10:21 +03:00
parent 3a817a56eb
commit a1b5d3abd1
No known key found for this signature in database
GPG Key ID: B538286DE04ECFE5
2 changed files with 4 additions and 14 deletions

View File

@ -207,7 +207,6 @@ local function adjusturi(reqt)
if not reqt.proxy and not _M.PROXY then if not reqt.proxy and not _M.PROXY then
u = { u = {
path = socket.try(reqt.path, "invalid path 'nil'"), path = socket.try(reqt.path, "invalid path 'nil'"),
params = reqt.params,
query = reqt.query, query = reqt.query,
fragment = reqt.fragment fragment = reqt.fragment
} }

View File

@ -125,7 +125,7 @@ end
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Parses a url and returns a table with all its parts according to RFC 2396 -- Parses a url and returns a table with all its parts according to RFC 2396
-- The following grammar describes the names given to the URL parts -- The following grammar describes the names given to the URL parts
-- <url> ::= <scheme>://<authority>/<path>;<params>?<query>#<fragment> -- <url> ::= <scheme>://<authority>/<path>?<query>#<fragment>
-- <authority> ::= <userinfo>@<host>:<port> -- <authority> ::= <userinfo>@<host>:<port>
-- <userinfo> ::= <user>[:<password>] -- <userinfo> ::= <user>[:<password>]
-- <path> :: = {<segment>/}<segment> -- <path> :: = {<segment>/}<segment>
@ -136,7 +136,7 @@ end
-- table with the following fields, where RFC naming conventions have -- table with the following fields, where RFC naming conventions have
-- been preserved: -- been preserved:
-- scheme, authority, userinfo, user, password, host, port, -- scheme, authority, userinfo, user, password, host, port,
-- path, params, query, fragment -- path, query, fragment
-- Obs: -- Obs:
-- the leading '/' in {/<path>} is considered part of <path> -- the leading '/' in {/<path>} is considered part of <path>
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -166,11 +166,6 @@ function _M.parse(url, default)
parsed.query = q parsed.query = q
return "" return ""
end) end)
-- get params
url = string.gsub(url, "%;(.*)", function(p)
parsed.params = p
return ""
end)
-- path is whatever was left -- path is whatever was left
if url ~= "" then parsed.path = url end if url ~= "" then parsed.path = url end
local authority = parsed.authority local authority = parsed.authority
@ -203,7 +198,6 @@ function _M.build(parsed)
--local ppath = _M.parse_path(parsed.path or "") --local ppath = _M.parse_path(parsed.path or "")
--local url = _M.build_path(ppath) --local url = _M.build_path(ppath)
local url = parsed.path or "" local url = parsed.path or ""
if parsed.params then url = url .. ";" .. parsed.params end
if parsed.query then url = url .. "?" .. parsed.query end if parsed.query then url = url .. "?" .. parsed.query end
local authority = parsed.authority local authority = parsed.authority
if parsed.host then if parsed.host then
@ -258,12 +252,9 @@ function _M.absolute(base_url, relative_url)
relative_parsed.authority = base_parsed.authority relative_parsed.authority = base_parsed.authority
if not relative_parsed.path then if not relative_parsed.path then
relative_parsed.path = base_parsed.path relative_parsed.path = base_parsed.path
if not relative_parsed.params then
relative_parsed.params = base_parsed.params
if not relative_parsed.query then if not relative_parsed.query then
relative_parsed.query = base_parsed.query relative_parsed.query = base_parsed.query
end end
end
else else
relative_parsed.path = absolute_path(base_parsed.path or "", relative_parsed.path = absolute_path(base_parsed.path or "",
relative_parsed.path) relative_parsed.path)