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

Malformed encoding in chunked resposes #90

Closed
errno opened this issue Oct 27, 2020 · 3 comments
Closed

Malformed encoding in chunked resposes #90

errno opened this issue Oct 27, 2020 · 3 comments

Comments

@errno
Copy link

errno commented Oct 27, 2020

I was writing a CGI function which generates quite big responses (>2k). So it utilizes consecutive httpdSend() calls and HTTPD_CGI_MORE return code.
At some point I've stumbled upon corrupted responses. curl says Malformed encoding found in chunked-encoding.

Further digging revealed that I managed to fill conn->priv.sendBuff to the brim (exactly 2048 bytes) before returning from the function with HTTPD_CGI_MORE. That, in turn, caused a problem in httpdFlushSendBuffer(), because there is no room for closing a chunk with \r\n, and chunk length is calculated incorrectly.

I'm going to try to fix this issue myself. If I succeed I'll open a pull request.

@errno
Copy link
Author

errno commented Oct 27, 2020

That was relatively easy. I hope my approach is acceptable. And my changes didn't break other stuff :)

@phatpaul
Copy link
Collaborator

Merged (better late than never right?). Thanks.
BTW, maybe #93 is related to this issue. I'll test that again now that this is merged.

@errno
Copy link
Author

errno commented Apr 29, 2021

Hurray! It's just the right time.
I've returned to working on the project in which I discovered this issue a few days ago, so now I can switch back from my fork :)

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