From a1b5d3abd1e841fad9e91a627634a927cac41078 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 9 Nov 2023 14:10:21 +0300 Subject: [PATCH] chore(url)!: Remove params parsing, part of deprecated URL schema --- src/http.lua | 1 - src/url.lua | 17 ++++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/http.lua b/src/http.lua index fbd5ff6..340f45a 100644 --- a/src/http.lua +++ b/src/http.lua @@ -207,7 +207,6 @@ local function adjusturi(reqt) if not reqt.proxy and not _M.PROXY then u = { path = socket.try(reqt.path, "invalid path 'nil'"), - params = reqt.params, query = reqt.query, fragment = reqt.fragment } diff --git a/src/url.lua b/src/url.lua index aef1698..fbba853 100644 --- a/src/url.lua +++ b/src/url.lua @@ -125,7 +125,7 @@ end ----------------------------------------------------------------------------- -- 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 --- ::= :///;?# +-- ::= :///?# -- ::= @: -- ::= [:] -- :: = {/} @@ -136,7 +136,7 @@ end -- table with the following fields, where RFC naming conventions have -- been preserved: -- scheme, authority, userinfo, user, password, host, port, --- path, params, query, fragment +-- path, query, fragment -- Obs: -- the leading '/' in {/} is considered part of ----------------------------------------------------------------------------- @@ -166,11 +166,6 @@ function _M.parse(url, default) parsed.query = q return "" end) - -- get params - url = string.gsub(url, "%;(.*)", function(p) - parsed.params = p - return "" - end) -- path is whatever was left if url ~= "" then parsed.path = url end local authority = parsed.authority @@ -203,7 +198,6 @@ function _M.build(parsed) --local ppath = _M.parse_path(parsed.path or "") --local url = _M.build_path(ppath) local url = parsed.path or "" - if parsed.params then url = url .. ";" .. parsed.params end if parsed.query then url = url .. "?" .. parsed.query end local authority = parsed.authority if parsed.host then @@ -258,11 +252,8 @@ function _M.absolute(base_url, relative_url) relative_parsed.authority = base_parsed.authority if not relative_parsed.path then relative_parsed.path = base_parsed.path - if not relative_parsed.params then - relative_parsed.params = base_parsed.params - if not relative_parsed.query then - relative_parsed.query = base_parsed.query - end + if not relative_parsed.query then + relative_parsed.query = base_parsed.query end else relative_parsed.path = absolute_path(base_parsed.path or "",