Skip to content

Commit 679f842

Browse files
authored
Merge pull request #1435 from 3scale/http-proxy-cleanup
gateway/src/apicast/http_proxy.lua: remove unused code
2 parents 3656233 + 31939a6 commit 679f842

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

gateway/src/apicast/http_proxy.lua

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ local format = string.format
22

33
local resty_url = require "resty.url"
44
local resty_resolver = require 'resty.resolver'
5-
local round_robin = require 'resty.balancer.round_robin'
65
local http_proxy = require 'resty.http.proxy'
76
local file_reader = require("resty.file").file_reader
87
local concat = table.concat
98

109
local _M = { }
1110

1211
function _M.reset()
13-
_M.balancer = round_robin.new()
1412
_M.resolver = resty_resolver
1513
_M.http_backend = require('resty.http_ng.backend.resty')
1614
_M.dns_resolution = 'apicast' -- can be set to 'proxy' to let proxy do the name resolution
@@ -32,45 +30,6 @@ local function resolve_servers(uri)
3230
return resolver:get_servers(uri.host, uri)
3331
end
3432

35-
function _M.resolve(uri)
36-
local balancer = _M.balancer
37-
38-
if not balancer then
39-
return nil, 'not initialized'
40-
end
41-
42-
local servers, err = resolve_servers(uri)
43-
44-
if err then
45-
return nil, err
46-
end
47-
48-
local peers = balancer:peers(servers)
49-
local peer = balancer:select_peer(peers)
50-
51-
local ip = uri.host
52-
local port = uri.port
53-
54-
if peer then
55-
ip = peer[1]
56-
port = peer[2]
57-
end
58-
59-
return ip, port
60-
end
61-
62-
-- #TODO: This local function is no longer called as of PR#1323 and should be removed
63-
local function resolve(uri)
64-
local host = uri.host
65-
local port = uri.port
66-
67-
if _M.dns_resolution == 'apicast' then
68-
host, port = _M.resolve(uri)
69-
end
70-
71-
return host, port or resty_url.default_port(uri.scheme)
72-
end
73-
7433
local function absolute_url(uri)
7534
-- target server requires hostname not IP and DNS resolution is left to the proxy itself as specified in the RFC #7231
7635
-- https://httpwg.org/specs/rfc7231.html#CONNECT

0 commit comments

Comments
 (0)