Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request_uri() lost Trailer? #269

Open
ssdr opened this issue Mar 20, 2022 · 1 comment
Open

request_uri() lost Trailer? #269

ssdr opened this issue Mar 20, 2022 · 1 comment

Comments

@ssdr
Copy link

ssdr commented Mar 20, 2022

local body, err = res:read_body()
if not body then
self:close()
return nil, err
end
res.body = body
if params.keepalive == false then
local ok, err = self:close()
if not ok then
ngx_log(ngx_ERR, err)
end

In function request_uri(), we read response body by res:read_body(), but Trailer is not be read before closing connection I think.

Correct me if I am wrong~

Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer

@pintsized
Copy link
Member

Yes, it looks like with the "single shot" interface (request_uri) we don't read the trailers. I don't remember if there was a reason for this or not, but perhaps it is simply an oversight.

With the generic interface you just need to call res:read_trailers() after reading the body.

PRs welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants