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;
}
https://github.com/simonwittber/uniwebserver/blob/5b0a566ae88c8a0618d0050ca18c908185d5cce7/UniWebServer/Assets/UniWebServer/Lib/WebServer.cs#L123-L126
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 VMRead()
gets called multiple times and it started chopping up our uploaded data.To fix the issue we corrected the usage of
Read()
:Hope this saves someone some time. That's all.