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

bug: wrong trailer format parsing #295

Open
kingluo opened this issue Apr 11, 2023 · 0 comments
Open

bug: wrong trailer format parsing #295

kingluo opened this issue Apr 11, 2023 · 0 comments

Comments

@kingluo
Copy link

kingluo commented Apr 11, 2023

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.

else
-- Read the last (zero length) chunk's carriage return
sock:receive(2) -- read \r\n
end

table.insert(res, body)
table.insert(res, "0")
table.insert(res, "")
table.insert(res, "Content-MD5: " .. ngx.md5(body))
table.insert(res, "")
table.insert(res, "")

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

1 participant