lua-resty-http icon indicating copy to clipboard operation
lua-resty-http copied to clipboard

request_uri() lost Trailer?

Open ssdr opened this issue 2 years ago • 1 comments

https://github.com/ledgetech/lua-resty-http/blob/2af9925acf5cbb5b387539cd4463552ebbd5efee/lib/resty/http.lua#L937-L950

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

ssdr avatar Mar 20 '22 14:03 ssdr

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 :)

pintsized avatar Mar 29 '22 10:03 pintsized