Skip to content

Commit cc9e738

Browse files
committed
doc: various wording improvements and link fixes from Dayo Akanji.
1 parent c135f05 commit cc9e738

File tree

2 files changed

+127
-109
lines changed

2 files changed

+127
-109
lines changed

README.markdown

Lines changed: 64 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Table of Contents
5353
Status
5454
======
5555

56-
This module is under active development and is production ready.
56+
Production ready.
5757

5858
Version
5959
=======
@@ -312,8 +312,8 @@ The [ngx_openresty bundle](http://openresty.org) can be used to install Nginx, n
312312
Alternatively, ngx_lua can be manually compiled into Nginx:
313313

314314
1. Install LuaJIT 2.0 or 2.1 (recommended) or Lua 5.1 (Lua 5.2 is *not* supported yet). LuaJIT can be downloaded from the [the LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuajIT and/or Lua.
315-
1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](http://github.com/simpl/ngx_devel_kit/tags).
316-
1. Download the latest version of ngx_lua [HERE](http://github.com/openresty/lua-nginx-module/tags).
315+
1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](https://github.com/simpl/ngx_devel_kit/tags).
316+
1. Download the latest version of ngx_lua [HERE](https://github.com/openresty/lua-nginx-module/tags).
317317
1. Download the latest version of Nginx [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility))
318318

319319
Build the source with this module:
@@ -412,7 +412,7 @@ The [openresty](https://groups.google.com/group/openresty) mailing list is for C
412412
Code Repository
413413
===============
414414

415-
The code repository of this project is hosted on github at [openresty/lua-nginx-module](http://github.com/openresty/lua-nginx-module).
415+
The code repository of this project is hosted on github at [openresty/lua-nginx-module](https://github.com/openresty/lua-nginx-module).
416416

417417
[Back to TOC](#table-of-contents)
418418

@@ -881,22 +881,22 @@ The following dependencies are required to run the test suite:
881881
* Nginx version >= 1.4.2
882882

883883
* Perl modules:
884-
* Test::Nginx: <http://github.com/openresty/test-nginx>
884+
* Test::Nginx: <https://github.com/openresty/test-nginx>
885885

886886
* Nginx modules:
887887
* [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit)
888-
* [ngx_set_misc](http://github.com/openresty/set-misc-nginx-module)
888+
* [ngx_set_misc](https://github.com/openresty/set-misc-nginx-module)
889889
* [ngx_auth_request](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz) (this is not needed if you're using Nginx 1.5.4+.
890-
* [ngx_echo](http://github.com/openresty/echo-nginx-module)
891-
* [ngx_memc](http://github.com/openresty/memc-nginx-module)
892-
* [ngx_srcache](http://github.com/openresty/srcache-nginx-module)
890+
* [ngx_echo](https://github.com/openresty/echo-nginx-module)
891+
* [ngx_memc](https://github.com/openresty/memc-nginx-module)
892+
* [ngx_srcache](https://github.com/openresty/srcache-nginx-module)
893893
* ngx_lua (i.e., this module)
894-
* [ngx_lua_upstream](http://github.com/openresty/lua-upstream-nginx-module)
895-
* [ngx_headers_more](http://github.com/openresty/headers-more-nginx-module)
896-
* [ngx_drizzle](http://github.com/openresty/drizzle-nginx-module)
897-
* [ngx_rds_json](http://github.com/openresty/rds-json-nginx-module)
894+
* [ngx_lua_upstream](https://github.com/openresty/lua-upstream-nginx-module)
895+
* [ngx_headers_more](https://github.com/openresty/headers-more-nginx-module)
896+
* [ngx_drizzle](https://github.com/openresty/drizzle-nginx-module)
897+
* [ngx_rds_json](https://github.com/openresty/rds-json-nginx-module)
898898
* [ngx_coolkit](https://github.com/FRiCKLE/ngx_coolkit)
899-
* [ngx_redis2](http://github.com/openresty/redis2-nginx-module)
899+
* [ngx_redis2](https://github.com/openresty/redis2-nginx-module)
900900

901901
The order in which these modules are added during configuration is important because the position of any filter module in the
902902
filtering chain determines the final output, for example. The correct adding order is shown above.
@@ -955,22 +955,23 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
955955
See Also
956956
========
957957

958-
* [lua-resty-memcached](http://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket.
959-
* [lua-resty-redis](http://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket.
960-
* [lua-resty-mysql](http://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket.
961-
* [lua-resty-upload](http://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket.
962-
* [lua-resty-dns](http://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket.
963-
* [lua-resty-websocket](http://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket.
964-
* [lua-resty-string](http://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html).
965-
* [lua-resty-lock](http://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API.
958+
* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket.
959+
* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket.
960+
* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket.
961+
* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket.
962+
* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket.
963+
* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket.
964+
* [lua-resty-string](https://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html).
965+
* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API.
966+
* [lua-resty-cookie](https://github.com/cloudflare/lua-resty-cookie) library for HTTP cookie manipulation.
966967
* [Routing requests to different MySQL queries based on URI arguments](http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs)
967968
* [Dynamic Routing Based on Redis and Lua](http://openresty.org/#DynamicRoutingBasedOnRedis)
968969
* [Using LuaRocks with ngx_lua](http://openresty.org/#UsingLuaRocks)
969970
* [Introduction to ngx_lua](https://github.com/openresty/lua-nginx-module/wiki/Introduction)
970-
* [ngx_devel_kit](http://github.com/simpl/ngx_devel_kit)
971+
* [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit)
971972
* [echo-nginx-module](http://github.com/openresty/echo-nginx-module)
972973
* [drizzle-nginx-module](http://github.com/openresty/drizzle-nginx-module)
973-
* [postgres-nginx-module](http://github.com/FRiCKLE/ngx_postgres)
974+
* [postgres-nginx-module](https://github.com/FRiCKLE/ngx_postgres)
974975
* [memc-nginx-module](http://github.com/openresty/memc-nginx-module)
975976
* [The ngx_openresty bundle](http://openresty.org)
976977
* [Nginx Systemtap Toolkit](https://github.com/openresty/nginx-systemtap-toolkit)
@@ -4123,7 +4124,7 @@ ngx.exec
41234124

41244125
**context:** *rewrite_by_lua*, access_by_lua*, content_by_lua**
41254126

4126-
Does an internal redirect to `uri` with `args`.
4127+
Does an internal redirect to `uri` with `args` and is similar to the [echo_exec](http://github.com/openresty/echo-nginx-module#echo_exec) directive of the [echo-nginx-module](http://github.com/openresty/echo-nginx-module).
41274128

41284129
```lua
41294130

@@ -4132,21 +4133,6 @@ ngx.exec('/some-location', 'a=3&b=5&c=6');
41324133
ngx.exec('/some-location?a=3&b=5', 'c=6');
41334134
```
41344135

4135-
Named locations are also supported (but the second `args` argument is currently ignored). For example,
4136-
4137-
```nginx
4138-
4139-
location /foo {
4140-
content_by_lua '
4141-
ngx.exec("@bar");
4142-
';
4143-
}
4144-
4145-
location @bar {
4146-
...
4147-
}
4148-
```
4149-
41504136
The optional second `args` can be used to specify extra URI query arguments, for example:
41514137

41524138
```lua
@@ -4161,19 +4147,41 @@ Alternatively, a Lua table can be passed for the `args` argument for ngx_lua to
41614147
ngx.exec("/foo", { a = 3, b = "hello world" })
41624148
```
41634149

4164-
The result is exactly the same as the previous example. The format for the Lua table passed as the `args` argument is identical to the format used in the [ngx.encode_args](#ngxencode_args) method.
4150+
The result is exactly the same as the previous example.
41654151

4166-
Note that this is very different from [ngx.redirect](#ngxredirect) in that
4167-
it is just an internal redirect and no new HTTP traffic is involved.
4152+
The format for the Lua table passed as the `args` argument is identical to the format used in the [ngx.encode_args](#ngxencode_args) method.
41684153

4169-
This method never returns.
4154+
Named locations are also supported but the second `args` argument will be ignored if present and the querystring for the new target is inherited from the referring location (if any).
41704155

4171-
This method *must* be called before [ngx.send_headers](#ngxsend_headers) or explicit response body
4172-
outputs by either [ngx.print](#ngxprint) or [ngx.say](#ngxsay).
4156+
`GET /foo/file.php?a=hello` will return "hello" and not "goodbye" in the example below
4157+
4158+
```nginx
4159+
4160+
location /foo {
4161+
content_by_lua '
4162+
ngx.exec("@bar", "a=goodbye");
4163+
';
4164+
}
4165+
4166+
location @bar {
4167+
content_by_lua '
4168+
local args = ngx.req.get_uri_args()
4169+
for key, val in pairs(args) do
4170+
if key == "a" then
4171+
ngx.say(val)
4172+
end
4173+
end
4174+
';
4175+
}
4176+
```
41734177

4174-
It is strongly recommended to combine the `return` statement with this call, i.e., `return ngx.exec(...)`.
4178+
Note that the `ngx.exec` method is different from [ngx.redirect](#ngxredirect) in that
4179+
it is purely an internal redirect and that no new external HTTP traffic is involved.
41754180

4176-
This method is similar to the [echo_exec](http://github.com/openresty/echo-nginx-module#echo_exec) directive of the [echo-nginx-module](http://github.com/openresty/echo-nginx-module).
4181+
Also note that this method call terminates the processing of the current request and that it *must* be called before [ngx.send_headers](#ngxsend_headers) or explicit response body
4182+
outputs by either [ngx.print](#ngxprint) or [ngx.say](#ngxsay).
4183+
4184+
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](#header_filter_by_lua) to reinforce the fact that the request processing is being terminated.
41774185

41784186
[Back to TOC](#nginx-api-for-lua)
41794187

@@ -4188,7 +4196,7 @@ Issue an `HTTP 301` or `302` redirection to `uri`.
41884196
The optional `status` parameter specifies whether
41894197
`301` or `302` to be used. It is `302` (`ngx.HTTP_MOVED_TEMPORARILY`) by default.
41904198

4191-
Here is an example assuming the current server name is `localhost` and that it is listening on Port 1984:
4199+
Here is an example assuming the current server name is `localhost` and that it is listening on port 1984:
41924200

41934201
```lua
41944202

@@ -4216,9 +4224,7 @@ We can also use the numerical code directly as the second `status` argument:
42164224
return ngx.redirect("/foo", 301)
42174225
```
42184226

4219-
This method *must* be called before [ngx.send_headers](#ngxsend_headers) or explicit response body outputs by either [ngx.print](#ngxprint) or [ngx.say](#ngxsay).
4220-
4221-
This method is very much like the [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) directive with the `redirect` modifier in the standard
4227+
This method is similar to the [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) directive with the `redirect` modifier in the standard
42224228
[[HttpRewriteModule]], for example, this `nginx.conf` snippet
42234229

42244230
```nginx
@@ -4254,7 +4260,10 @@ URI arguments can be specified as well, for example:
42544260
return ngx.redirect('/foo?a=3&b=4')
42554261
```
42564262

4257-
This method call terminates the current request's processing and never returns. It is recommended to combine the `return` statement with this call, i.e., `return ngx.redirect(...)`, so as to be more explicit.
4263+
Note that this method call terminates the processing of the current request and that it *must* be called before [ngx.send_headers](#ngxsend_headers) or explicit response body
4264+
outputs by either [ngx.print](#ngxprint) or [ngx.say](#ngxsay).
4265+
4266+
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](#header_filter_by_lua) to reinforce the fact that the request processing is being terminated.
42584267

42594268
[Back to TOC](#nginx-api-for-lua)
42604269

@@ -4419,9 +4428,9 @@ ngx.exit(501)
44194428

44204429
Note that while this method accepts all [HTTP status constants](#http-status-constants) as input, it only accepts `NGX_OK` and `NGX_ERROR` of the [core constants](#core-constants).
44214430

4422-
It is recommended, though not necessary (for contexts other than [header_filter_by_lua](#header_filter_by_lua)), to combine the `return` statement with this call, i.e., `return ngx.exit(...)`, to give a visual hint to others reading the code.
4431+
Also note that this method call terminates the processing of the current request and that it is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.exit(...)` be used to reinforce the fact that the request processing is being terminated.
44234432

4424-
When being used in the context of [header_filter_by_lua](#header_filter_by_lua), `ngx.exit()` is an asynchronous operation and will return immediately. This behavior might change in the future. So always use `return` at the same time, as suggested above.
4433+
When being used in the context of [header_filter_by_lua](#header_filter_by_lua), `ngx.exit()` is an asynchronous operation and will return immediately. This behavior may change in future and it is recommended that users always use `return` in combination as suggested above.
44254434

44264435
[Back to TOC](#nginx-api-for-lua)
44274436

0 commit comments

Comments
 (0)