Skip to content

Commit d618ab3

Browse files
committed
bugfix: prevented loading HTTP subsystem only modules in non-HTTP subsystem.
Also removed modules loaded repeatly both in global and in HTTP subsystem from resty/core.lua.
1 parent 5eafe03 commit d618ab3

File tree

12 files changed

+39
-19
lines changed

12 files changed

+39
-19
lines changed

lib/resty/core.lua

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ require "resty.core.time"
99

1010

1111
if subsystem == 'http' then
12-
require "resty.core.uri"
13-
require "resty.core.hash"
1412
require "resty.core.base64"
15-
require "resty.core.regex"
16-
require "resty.core.exit"
17-
require "resty.core.var"
1813
require "resty.core.ctx"
14+
require "resty.core.exit"
15+
require "resty.core.hash"
1916
require "resty.core.misc"
17+
require "resty.core.ndk"
18+
require "resty.core.phase"
2019
require "resty.core.request"
2120
require "resty.core.response"
22-
require "resty.core.time"
21+
require "resty.core.uri"
22+
require "resty.core.var"
2323
require "resty.core.worker"
24-
require "resty.core.phase"
25-
require "resty.core.ndk"
2624
end
2725

2826

lib/resty/core/base64.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4-
local ffi = require 'ffi'
54
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
67

8+
local ffi = require 'ffi'
79
local ffi_string = ffi.string
810
local C = ffi.C
911
local ngx = ngx

lib/resty/core/ctx.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4+
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
7+
48
local ffi = require 'ffi'
59
local debug = require 'debug'
6-
local base = require "resty.core.base"
710
local misc = require "resty.core.misc"
811

912

lib/resty/core/exit.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4+
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
7+
48
local ffi = require 'ffi'
59
local ffi_string = ffi.string
610
local C = ffi.C
711
local ngx = ngx
812
local error = error
9-
local base = require "resty.core.base"
1013
local get_string_buf = base.get_string_buf
1114
local get_size_ptr = base.get_size_ptr
1215
local get_request = base.get_request

lib/resty/core/hash.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4+
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
7+
48
local ffi = require 'ffi'
59
local ffi_string = ffi.string
610
local ffi_new = ffi.new
@@ -9,7 +13,6 @@ local ngx = ngx
913
local type = type
1014
local tostring = tostring
1115
local error = error
12-
local base = require "resty.core.base"
1316

1417

1518
ffi.cdef[[

lib/resty/core/misc.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33

44
local base = require "resty.core.base"
5-
local ffi = require "ffi"
5+
base.allows_subsystem('http')
66

77

8+
local ffi = require "ffi"
89
local FFI_NO_REQ_CTX = base.FFI_NO_REQ_CTX
910
local FFI_BAD_CONTEXT = base.FFI_BAD_CONTEXT
1011
local new_tab = base.new_tab

lib/resty/core/phase.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
local ffi = require 'ffi'
21
local base = require "resty.core.base"
2+
base.allows_subsystem('http')
3+
34

5+
local ffi = require 'ffi'
46
local C = ffi.C
57
local FFI_ERROR = base.FFI_ERROR
68
local get_request = base.get_request

lib/resty/core/request.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4-
local ffi = require 'ffi'
54
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
66

77

8+
local ffi = require 'ffi'
89
local FFI_BAD_CONTEXT = base.FFI_BAD_CONTEXT
910
local FFI_DECLINED = base.FFI_DECLINED
1011
local FFI_OK = base.FFI_OK

lib/resty/core/response.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4-
local ffi = require 'ffi'
54
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
66

77

8+
local ffi = require 'ffi'
89
local C = ffi.C
910
local ffi_cast = ffi.cast
1011
local ffi_str = ffi.string

lib/resty/core/uri.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4+
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
7+
48
local ffi = require 'ffi'
59
local ffi_string = ffi.string
610
local C = ffi.C
711
local ngx = ngx
812
local type = type
913
local tostring = tostring
10-
local base = require "resty.core.base"
1114
local get_string_buf = base.get_string_buf
1215

1316

lib/resty/core/var.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4-
local ffi = require 'ffi'
54
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
6+
67

8+
local ffi = require 'ffi'
79
local ffi_new = ffi.new
810
local ffi_str = ffi.string
911
local C = ffi.C

lib/resty/core/worker.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
-- Copyright (C) Yichun Zhang (agentzh)
22

33

4-
local ffi = require 'ffi'
54
local base = require "resty.core.base"
5+
base.allows_subsystem('http')
66

77

8+
local ffi = require 'ffi'
89
local C = ffi.C
910

1011

0 commit comments

Comments
 (0)