Open misiek08 opened 10 years ago
@misiek08 I'm not the maintainer of liseen's lua-resty-http you're posting the issue to but I know James Hurst's version of lua-resty-http does support reading big response bodies in chunks from the remote end:
https://github.com/pintsized/lua-resty-http
To implement strict non-buffered proxying, you need to read a chunk from the upstream and then call
ngx.print(data_chunk)
ngx.flush(true)
afterwards. That is, sending out a data chunk to the downstream completely before reading the next data chunk from the upstream.
I think that's right time to all lua-resty-http's get together, make one powerful and rich-feature library :)
One library accepts cookie as array (it's very important for me), one have raw api to use chunk instead of whole body (it's most important feature) and other have some different thing...
@agentzh thank's for that reply, I just thought that I can't do this that way. I wasn't trying, because I'll have time at the weekend for it.
@misiek08 Yeah, hopefully there will be an official lua-resty-http library soon :)
I'm looking for ability to set cookie file (like in curl) or multiple cookies as array... I'm now working on code.
for key, values in pairs(headers) do
if type(values) ~= "table" then
values = {values}
end
key = tostring(key)
for _, value in pairs(values) do
req[c] = key .. ": " .. tostring(value) .. "\r\n"
c = c + 1
end
end
Here we need change for cookies :)
@misiek08 I think you can just construct the Cookie
headers yourself. But I'm no expert of this particular Lua library.
I'm using lua with nginx and I need to do some piping. I need to auth in lua on 3rd party website and then download file but not to my server, but directly piping to user.
nginx ==> 3rdparty/auth nginx <== 3rdparty: You are logged in nginx ==> 3rdparty/get/file/x.tar.gz; nginx <== 3rdparty: Here you are... binary data nginx.on_3rdparty_chunk(data) ==> nginx.send_to_client(data)
Is it possible? Can you give a simple example?