Skip to content

Commit fef48f2

Browse files
committed
Ensure that no-client-cert fails for right reason (i.e. not because client doesn't trust server cert).
1 parent 9ca2f8a commit fef48f2

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

http/test/test_mtls_client.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ function TestMTLS(t)
44
assert(tURL, 'tURL global is not set')
55

66
t:Run('no-client-cert fails', function(t)
7-
local client = http.client()
7+
local client = http.client{
8+
insecure_ssl = true,
9+
}
810
local req, err = http.request("GET", tURL)
911
assert(not err, tostring(err))
1012
local resp, err = client:do_request(req)

http/test/test_mtls_server_with_client.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function TestMTLSServerWithClient(t)
99
local addr_ch = unpack(arg)
1010
local http = require 'http'
1111
local server, err = http.server {
12+
client_cas_pem_file = "test/data/test.cert.pem",
13+
client_auth = "RequireAndVerifyClientCert",
1214
server_public_cert_pem_file = "test/data/test.cert.pem",
1315
server_private_key_pem_file = "test/data/test.key.pem",
1416
}
@@ -30,7 +32,9 @@ function TestMTLSServerWithClient(t)
3032
local tURL = string.format("https://%s/", addr)
3133

3234
t:Run('no-client-cert fails', function(t)
33-
local client = http.client()
35+
local client = http.client {
36+
insecure_ssl = true,
37+
}
3438
local req, err = http.request("GET", tURL)
3539
assert(not err, tostring(err))
3640
local resp, err = client:do_request(req)

http/test/test_server.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function Test_do_handle_function(t)
1212
assert(not err, tostring(err))
1313
addr_ch:send(server:addr())
1414
server:do_handle_function(function(response, request)
15-
print(string.format("response = %s", response))
1615
response:code(200)
1716
response:write("OK\n")
1817
response:done()

0 commit comments

Comments
 (0)