Skip to content

Commit 399c01e

Browse files
authored
tests(github) add lint and bump nginx 1.21.4 (#83)
1 parent 9a4e190 commit 399c01e

File tree

4 files changed

+60
-17
lines changed

4 files changed

+60
-17
lines changed

.github/workflows/lint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
paths:
6+
- lib/**.lua
7+
pull_request:
8+
paths:
9+
- lib/**.lua
10+
11+
jobs:
12+
tests:
13+
name: Lint
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- name: Checkout source code
18+
uses: actions/checkout@v2
19+
- uses: Jayrgo/luacheck-action@v1
20+
name: luacheck
21+
with:
22+
# List of files, directories and rockspecs to check.
23+
# Default: .
24+
files: 'lib'
25+
26+
# Path to configuration file.
27+
# Default: .luacheckrc
28+
config: '.luacheckrc'
29+
30+
# Arguments passed to luacheck.
31+
# Default: -q
32+
args: '-q'

.github/workflows/tests.yml

+7-12
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,21 @@ jobs:
1414
strategy:
1515
matrix:
1616
include:
17+
- nginx: "1.21.4"
18+
openssl: "1.1.1q"
19+
lua_nginx_module: "v0.10.21"
20+
stream_lua_nginx_module: "v0.0.11"
21+
lua_resty_core: "v0.1.23"
1722
- nginx: "1.19.9"
18-
openssl: "1.1.1k"
19-
lua_nginx_module: "v0.10.20"
20-
stream_lua_nginx_module: "v0.0.10"
21-
lua_resty_core: "v0.1.22"
22-
- nginx: "1.19.9"
23-
openssl: "1.0.2u"
23+
openssl: "1.1.1q"
2424
lua_nginx_module: "v0.10.20"
2525
stream_lua_nginx_module: "v0.0.10"
2626
lua_resty_core: "v0.1.22"
2727
- nginx: "1.19.3"
28-
openssl: "1.1.1k"
28+
openssl: "1.1.1q"
2929
lua_nginx_module: "v0.10.19"
3030
stream_lua_nginx_module: "v0.0.9"
3131
lua_resty_core: "v0.1.21"
32-
- nginx: "1.17.8"
33-
openssl: "1.1.1k"
34-
lua_nginx_module: "v0.10.17"
35-
stream_lua_nginx_module: "v0.0.8"
36-
lua_resty_core: "v0.1.19"
3732

3833
env:
3934
JOBS: 3

.luacheckrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
std = "ngx_lua"
2+
unused_args = false
3+
redefined = false
4+
max_line_length = false
5+
6+
7+
not_globals = {
8+
"string.len",
9+
"table.getn",
10+
}
11+
12+
13+
ignore = {
14+
"6.", -- ignore whitespace warnings
15+
}

lib/resty/acme/client.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -475,16 +475,12 @@ function _M:finalize(finalize_url, order_url, csr)
475475
csr = encode_base64url(csr)
476476
}
477477

478-
local resp, headers, err = self:post(finalize_url, payload)
478+
local resp, _, err = self:post(finalize_url, payload)
479479

480480
if err then
481481
return nil, "failed to send finalize request: " .. err
482482
end
483483

484-
if not headers["content-type"] == "application/pem-certificate-chain" then
485-
return nil, "wrong content type"
486-
end
487-
488484
-- Wait until the order is valid: ready to download
489485
if not resp.certificate and resp.status and resp.status == "valid" then
490486
log(ngx_DEBUG, json.encode(resp))
@@ -502,6 +498,11 @@ function _M:finalize(finalize_url, order_url, csr)
502498
return nil, "failed to fetch certificate: " .. err
503499
end
504500

501+
local cert_content_type = headers["content-type"]
502+
if cert_content_type and string.sub(cert_content_type, 1, 33):lower() ~= "application/pem-certificate-chain" then
503+
return nil, "wrong content type, got " .. cert_content_type
504+
end
505+
505506
local preferred_chain = self.conf.preferred_chain
506507
if not preferred_chain then
507508
return body

0 commit comments

Comments
 (0)