You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: meta/3rd/OpenResty/library/ngx.lua
+28-26Lines changed: 28 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -1237,7 +1237,7 @@ function ngx.decode_base64(str) end
1237
1237
--- An optional boolean-typed `no_padding` argument can be specified to control whether the base64 padding should be appended to the resulting digest (default to `false`, i.e., with padding enabled).
1238
1238
---
1239
1239
---@paramstrstring
1240
-
---@paramno_paddingboolean
1240
+
---@paramno_padding?boolean
1241
1241
---@returnstring
1242
1242
functionngx.encode_base64(str, no_padding) end
1243
1243
@@ -1537,7 +1537,7 @@ function DICT:flush_all() end
1537
1537
---
1538
1538
--- Unlike the `flush_all` method, this method actually frees up the memory used by the expired items.
1539
1539
---
1540
-
---@parammax_countnumber
1540
+
---@parammax_count?number
1541
1541
---@returnnumber flushed
1542
1542
functionDICT:flush_expired(max_count) end
1543
1543
@@ -1548,7 +1548,7 @@ function DICT:flush_expired(max_count) end
1548
1548
---
1549
1549
--- **CAUTION** Avoid calling this method on dictionaries with a very large number of keys as it may lock the dictionary for significant amount of time and block NGINX worker processes trying to access the dictionary.
1550
1550
---
1551
-
---@parammax_countnumber
1551
+
---@parammax_count?number
1552
1552
---@returnstring[] keys
1553
1553
functionDICT:get_keys(max_count) end
1554
1554
@@ -2042,7 +2042,7 @@ function ngx.req.set_body_data(data) end
2042
2042
---
2043
2043
--- Removing the `max_args` cap is strongly discouraged.
2044
2044
---
2045
-
---@parammax_argsnumber
2045
+
---@parammax_args?number
2046
2046
---@returntable args
2047
2047
---@returnstring|'"truncated"' error
2048
2048
functionngx.req.get_post_args(max_args) end
@@ -2272,7 +2272,7 @@ function ngx.req.get_method() end
2272
2272
---
2273
2273
--- You can use the "raw request socket" returned by `ngx.req.socket(true)` to implement fancy protocols like `WebSocket`, or just emit your own raw HTTP response header or body data. You can refer to the `lua-resty-websocket library` for a real world example.
2274
2274
---
2275
-
---@paramrawboolean
2275
+
---@paramraw?boolean
2276
2276
---@returntcpsock?socket
2277
2277
---@returnstring?error
2278
2278
functionngx.req.socket(raw) end
@@ -2313,7 +2313,7 @@ function ngx.req.finish_body() end
2313
2313
---
2314
2314
--- This method does not work in HTTP/2 requests yet.
2315
2315
---
2316
-
---@paramno_request_lineboolean
2316
+
---@paramno_request_line?boolean
2317
2317
---@returnstring
2318
2318
functionngx.req.raw_header(no_request_line) end
2319
2319
@@ -2348,7 +2348,7 @@ function ngx.req.start_time() end
2348
2348
---
2349
2349
--- This function can be used with `ngx.req.append_body`, `ngx.req.finish_body`, and `ngx.req.socket` to implement efficient input filters in pure Lua (in the context of `rewrite_by_lua*` or `access_by_lua*`), which can be used with other NGINX content handler or upstream modules like `ngx_http_proxy_module` and `ngx_http_fastcgi_module`.
2350
2350
---
2351
-
---@parambuffer_sizenumber
2351
+
---@parambuffer_size?number
2352
2352
functionngx.req.init_body(buffer_size) end
2353
2353
2354
2354
--- Set the current request's request body using the in-file data specified by the `file_name` argument.
@@ -2362,7 +2362,7 @@ function ngx.req.init_body(buffer_size) end
2362
2362
--- Whether the previous request body has been read into memory or buffered into a disk file, it will be freed or the disk file will be cleaned up immediately, respectively.
2363
2363
---
2364
2364
---@paramfile_namestring
2365
-
---@paramauto_cleanboolean
2365
+
---@paramauto_clean?boolean
2366
2366
functionngx.req.set_body_file(file_name, auto_clean) end
2367
2367
2368
2368
--- Clears the current request's request header named `header_name`. None of the current request's existing subrequests will be affected but subsequently initiated subrequests will inherit the change by default.
@@ -2628,7 +2628,7 @@ function ngx.encode_args(args) end
2628
2628
--- Removing the `max_args` cap is strongly discouraged.
2629
2629
---
2630
2630
---@paramstrstring
2631
-
---@parammax_argsnumber
2631
+
---@parammax_args?number
2632
2632
---@returntable args
2633
2633
---@returnstring|'"truncated"' error
2634
2634
functionngx.decode_args(str, max_args) end
@@ -2684,8 +2684,8 @@ local udpsock = {}
2684
2684
---
2685
2685
--- Calling this method on an already connected socket object will cause the original connection to be closed first.
2686
2686
---
2687
-
---@paramhoststring
2688
-
---@paramportnumber
2687
+
---@paramhoststring
2688
+
---@paramport?number
2689
2689
---@returnboolean ok
2690
2690
---@returnstring?error
2691
2691
functionudpsock:setpeername(host, port) end
@@ -2845,8 +2845,8 @@ local tcpsock = {}
2845
2845
--- Calling this method on an already connected socket object will cause the original connection to be closed first.
2846
2846
---
2847
2847
---@paramhoststring
2848
-
---@paramportnumber
2849
-
---@paramoptstcpsock.connect.opts
2848
+
---@paramport?number
2849
+
---@paramopts?tcpsock.connect.opts
2850
2850
---@returnboolean ok
2851
2851
---@returnstring?error
2852
2852
functiontcpsock:connect(host, port, opts) end
@@ -2900,11 +2900,12 @@ function tcpsock:connect(host, port, opts) end
2900
2900
--- For connections that have already done SSL/TLS handshake, this method returns
2901
2901
--- immediately.
2902
2902
---
2903
-
---@paramreused_session?userdata|boolean
2904
-
---@paramserver_namestring
2905
-
---@paramssl_verifyboolean
2906
-
---@paramsend_status_reqboolean
2903
+
---@paramreused_session?userdata|boolean
2904
+
---@paramserver_name?string
2905
+
---@paramssl_verify?boolean
2906
+
---@paramsend_status_req?boolean
2907
2907
---@returnuserdata|boolean session_or_ok
2908
+
---@returnstring?error
2908
2909
functiontcpsock:sslhandshake(reused_session, server_name, ssl_verify, send_status_req) end
2909
2910
2910
2911
@@ -2967,7 +2968,7 @@ function tcpsock:send(data) end
functiontcpsock:receiveuntil(pattern, options) end
3096
3097
@@ -3249,8 +3250,8 @@ function tcpsock:setoption(option, value) end
3249
3250
---
3250
3251
--- This method also makes the current cosocket object enter the "closed" state, so there is no need to manually call the `close` method on it afterwards.
3251
3252
---
3252
-
---@paramtimeoutnumber
3253
-
---@paramsizenumber
3253
+
---@paramtimeout?number
3254
+
---@paramsize?number
3254
3255
---@returnboolean ok
3255
3256
---@returnstring?error
3256
3257
functiontcpsock:setkeepalive(timeout, size) end
@@ -3278,7 +3279,7 @@ function tcpsock:getreusedtimes() end
3278
3279
--- There is no way to use the `settimeout` method to specify connecting timeout for this method and the `lua_socket_connect_timeout` directive must be set at configure time instead.
3279
3280
---
3280
3281
---@paramhoststring
3281
-
---@paramportnumber
3282
+
---@paramport?number
3282
3283
---@returntcpsock?socket
3283
3284
---@returnstring?error
3284
3285
functionngx.socket.connect(host,port) end
@@ -3478,9 +3479,10 @@ function ngx.exit(status) end
3478
3479
--- It is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.redirect(...)` be adopted when this method call is used in contexts other than `header_filter_by_lua*` to reinforce the fact that the request processing is being terminated.
3479
3480
---
3480
3481
---@paramuristring
3481
-
---@paramstatusnumber
3482
+
---@paramstatus? 301|302|303|307|308
3482
3483
functionngx.redirect(uri, status) end
3483
3484
3485
+
3484
3486
--- Registers a user Lua function as the callback which gets called automatically when the client closes the (downstream) connection prematurely.
3485
3487
---
3486
3488
--- Returns `1` if the callback is registered successfully or returns `nil` and a string describing the error otherwise.
@@ -3570,7 +3572,7 @@ function ngx.on_abort(callback) end
3570
3572
--- It is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.exec(...)` be adopted when this method call is used in contexts other than `header_filter_by_lua*` to reinforce the fact that the request processing is being terminated.
3571
3573
---
3572
3574
---@paramuristring
3573
-
---@paramargsstring|table<string,any>
3575
+
---@paramargs?string|table<string,any>
3574
3576
functionngx.exec(uri, args) end
3575
3577
3576
3578
ngx.location= {}
@@ -3832,7 +3834,7 @@ ngx.location = {}
3832
3834
--- Please also refer to restrictions on capturing locations configured by subrequest directives of other modules.
3833
3835
---
3834
3836
---@paramuringx.location.capture.uri
3835
-
---@paramoptionsngx.location.capture.options
3837
+
---@paramoptions?ngx.location.capture.options
3836
3838
---@returnngx.location.capture.response
3837
3839
functionngx.location.capture(uri, options) end
3838
3840
@@ -4185,7 +4187,7 @@ function ngx.send_headers() end
4185
4187
---
4186
4188
--- Returns `1` on success, or returns `nil` and a string describing the error otherwise.
0 commit comments