Hello!
On Mon, Mar 10, 2014 at 5:28 PM, James Marlowe wrote:
> res = ngx.location.capture(
> '/foo/bar',
> { method = ngx.HTTP_POST, body = 'hello, world' }
> )
>
> I could change the method to put, but how would I transfer a file?
Well, for now, you need to read the whole file in Lua to a Lua string
and pass it to the "body" option. Yes, this is quite inefficient for
large files.
We could add a "body_file" opiton to ngx.location.capture* functions,
just as the -f option in the echo_subreqruest directive in the
ngx_echo module. Patches welcome :)
Alternatively, you can try pure Lua implementations based on ngx_lua's
cosocket API (like lua-resty-http or lua-resty-fastcgi, depending on
the subrequest target here).
Regards,
-agentzh