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

bug: wrong trailer format parsing

Open kingluo opened this issue 2 years ago • 0 comments

The trailer headers should be in the following format:

...<body>...
0\r\n
Trailer-Header-A: foo\r\n
...
\r\n

However, the code thought there is an extra \r\n between 0\r\n and Trailer-Header-A: foo\r\n, so it consumes two more chars from the first header at the end of chunked body parsing, then the first parsed header becomes a truncated version: ailer-Header-A: foo\r\n.

https://github.com/ledgetech/lua-resty-http/blob/4ab4269cf442ba52507aa2c718f606054452fcad/lib/resty/http.lua#L486-L489

https://github.com/ledgetech/lua-resty-http/blob/4ab4269cf442ba52507aa2c718f606054452fcad/t/04-trailers.t#L79-L86

kingluo avatar Apr 11 '23 14:04 kingluo