uint read_bytes = 0;
int tmp_read_bytes;
fcgi_request *request = (fcgi_request*) SG(server_context);
+ size_t remaining = SG(request_info).content_length - SG(read_post_bytes);
- count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+ if (remaining < count_bytes) {
+ count_bytes = remaining;
+ }
while (read_bytes < count_bytes) {
tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {
{
uint read_bytes = 0;
int tmp_read_bytes;
+ size_t remaining = SG(request_info).content_length - SG(read_post_bytes);
- count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+ if (remaining < count_bytes) {
+ count_bytes = remaining;
+ }
while (read_bytes < count_bytes) {
fcgi_request *request = (fcgi_request*) SG(server_context);
if (request_body_fd == -1) {