Skip to content

Commit 9563e45

Browse files
authored
chore: adjust pass SNI in the request chunk (#146)
1 parent 6bd6a83 commit 9563e45

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

lib/resty/etcd/v3.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ local function http_request_chunk(self, http_cli)
593593
ssl_verify = self.ssl_verify,
594594
ssl_cert_path = self.ssl_cert_path,
595595
ssl_key_path = self.ssl_key_path,
596+
ssl_server_name = self.sni,
596597
})
597598
if not ok then
598599
if health_check.conf ~= nil then
@@ -679,7 +680,6 @@ local function request_chunk(self, method, path, opts, timeout)
679680
body = body,
680681
query = query,
681682
headers = headers,
682-
ssl_server_name = self.sni,
683683
})
684684
utils.log_info("http request method: ", method, " path: ", path,
685685
" body: ", body, " query: ", query)

t/v3/sni.t

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ done
140140
location /t {
141141
content_by_lua_block {
142142
local etcd, err = new_etcd(true, nil, nil, "127.0.0.1")
143-
local res, err = etcd:set("/test", "abc")
144-
check_res(res, err)
145-
146-
ngx.timer.at(0.1, function ()
147-
etcd:set("/test", "bcd3")
148-
end)
149-
150143
local cur_time = ngx.now()
151144
local body_chunk_fun, err = etcd:watch("/test", {timeout = 0.5})
152145
if not body_chunk_fun then
@@ -158,7 +151,7 @@ done
158151
}
159152
}
160153
--- response_body
161-
err: certificate host mismatch
154+
failed to watch: https://127.0.0.1:12379: certificate host mismatch
162155
163156
164157
@@ -167,21 +160,13 @@ err: certificate host mismatch
167160
location /t {
168161
content_by_lua_block {
169162
local etcd, err = new_etcd(true, nil, nil, "admin.apisix.dev")
170-
local res, err = etcd:set("/test", "abc")
171-
check_res(res, err)
172-
173-
ngx.timer.at(0.1, function ()
174-
etcd:set("/test", "bcd3")
175-
end)
176-
177163
local cur_time = ngx.now()
178164
local body_chunk_fun, err = etcd:watch("/test", {timeout = 0.5})
179165
if not body_chunk_fun then
180166
ngx.say("failed to watch: ", err)
181167
else
182168
ngx.say("done")
183169
end
184-
185170
}
186171
}
187172
--- response_body

0 commit comments

Comments
 (0)