Skip to content

Commit dd8e4df

Browse files
committed
http/request.lua: Ignore proxy path component
1 parent afc4433 commit dd8e4df

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

http/request.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,16 @@ function request_methods:go(timeout)
378378
if proxy then
379379
if type(proxy) == "string" then
380380
proxy = assert(uri_patt:match(proxy), "invalid proxy URI")
381+
proxy.path = nil -- ignore proxy.path component
381382
else
382383
assert(type(proxy) == "table" and getmetatable(proxy) == nil and proxy.scheme, "invalid proxy URI")
384+
proxy = {
385+
scheme = proxy.scheme;
386+
userinfo = proxy.userinfo;
387+
host = proxy.host;
388+
port = proxy.port;
389+
-- ignore proxy.path component
390+
}
383391
end
384392
if proxy.scheme == "http" or proxy.scheme == "https" then
385393
if tls then
@@ -423,9 +431,6 @@ function request_methods:go(timeout)
423431
if request_headers:get(":method") == "CONNECT" then
424432
error("cannot use HTTP Proxy with CONNECT method")
425433
end
426-
if proxy.path ~= nil and proxy.path ~= "" then
427-
error("an HTTP proxy cannot have a path component")
428-
end
429434
-- TODO: Check if :path already has authority?
430435
local old_url = self:to_uri(false)
431436
host = assert(proxy.host, "proxy is missing host")

0 commit comments

Comments
 (0)