Skip to content

Commit c9b629a

Browse files
committed
doc: added a note about the full-buffering nature of the ngx.location.capture* API. thanks cmaion for the original patch in #607.
1 parent 00f62a5 commit c9b629a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.markdown

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3159,7 +3159,7 @@ ngx.location.capture
31593159

31603160
**context:** *rewrite_by_lua*, access_by_lua*, content_by_lua**
31613161

3162-
Issue a synchronous but still non-blocking *Nginx Subrequest* using `uri`.
3162+
Issues a synchronous but still non-blocking *Nginx Subrequest* using `uri`.
31633163

31643164
Nginx's subrequests provide a powerful way to make non-blocking internal requests to other locations configured with disk file directory or *any* other nginx C modules like `ngx_proxy`, `ngx_fastcgi`, `ngx_memc`,
31653165
`ngx_postgres`, `ngx_drizzle`, and even ngx_lua itself and etc etc etc.
@@ -3170,6 +3170,9 @@ Subrequests are completely different from HTTP 301/302 redirection (via [ngx.red
31703170

31713171
You should always read the request body (by either calling [ngx.req.read_body](#ngxreqread_body) or configuring [lua_need_request_body](#lua_need_request_body) on) before initiating a subrequest.
31723172

3173+
This API function (as well as [ngx.location.capture_multi](#ngxlocationcapture_multi)) always buffers the whole response body of the subrequest in memory. Thus, you should use [cosockets](#ngxsockettcp)
3174+
and streaming processing instead if you have to handle large subrequest responses.
3175+
31733176
Here is a basic example:
31743177

31753178
```lua

doc/HttpLuaModule.wiki

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2545,7 +2545,7 @@ The <code>ngx.ctx</code> lookup requires relatively expensive metamethod calls a
25452545
25462546
'''context:''' ''rewrite_by_lua*, access_by_lua*, content_by_lua*''
25472547
2548-
Issue a synchronous but still non-blocking ''Nginx Subrequest'' using <code>uri</code>.
2548+
Issues a synchronous but still non-blocking ''Nginx Subrequest'' using <code>uri</code>.
25492549
25502550
Nginx's subrequests provide a powerful way to make non-blocking internal requests to other locations configured with disk file directory or ''any'' other nginx C modules like <code>ngx_proxy</code>, <code>ngx_fastcgi</code>, <code>ngx_memc</code>,
25512551
<code>ngx_postgres</code>, <code>ngx_drizzle</code>, and even ngx_lua itself and etc etc etc.
@@ -2556,6 +2556,9 @@ Subrequests are completely different from HTTP 301/302 redirection (via [[#ngx.r
25562556
25572557
You should always read the request body (by either calling [[#ngx.req.read_body|ngx.req.read_body]] or configuring [[#lua_need_request_body|lua_need_request_body]] on) before initiating a subrequest.
25582558
2559+
This API function (as well as [[#ngx.location.capture_multi|ngx.location.capture_multi]]) always buffers the whole response body of the subrequest in memory. Thus, you should use [[#ngx.socket.tcp|cosockets]]
2560+
and streaming processing instead if you have to handle large subrequest responses.
2561+
25592562
Here is a basic example:
25602563
25612564
<geshi lang="lua">

0 commit comments

Comments
 (0)