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 body mangling #11

Open
whfung opened this issue Apr 15, 2021 · 0 comments
Open

Request body mangling #11

whfung opened this issue Apr 15, 2021 · 0 comments

Comments

@whfung
Copy link

whfung commented Apr 15, 2021

while (count > 0) {
offset = stream.Read (bytes, offset, count);
count -= offset;
}

Apparently some of the forks already fix this, but we ran into POST requests being mangled when running this headless in a virtualized environment. After investigation, we found this block, which sets the read offset to the # of bytes read every iteration.

This doesn't happen on localhost because Read() fully empties the stream in one iteration but as soon as we deployed it on a VM Read() gets called multiple times and it started chopping up our uploaded data.

To fix the issue we corrected the usage of Read():

while (count > 0) {
	var bytesRead = stream.Read (bytes, offset, count);
        offset += bytesRead;
	count -= bytesRead;
}

Hope this saves someone some time. That's all.

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