mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 01:33:53 +00:00
Fixed potential infinite loop with content receiver
This commit is contained in:
parent
49c4c2f9c1
commit
ba685dbe48
@ -2083,7 +2083,9 @@ inline ssize_t write_content(Stream &strm, ContentProvider content_provider,
|
|||||||
written_length = strm.write(d, l);
|
written_length = strm.write(d, l);
|
||||||
};
|
};
|
||||||
data_sink.done = [&](void) { written_length = -1; };
|
data_sink.done = [&](void) { written_length = -1; };
|
||||||
data_sink.is_writable = [&](void) { return strm.is_writable(); };
|
data_sink.is_writable = [&](void) {
|
||||||
|
return strm.is_writable() && written_length >= 0;
|
||||||
|
};
|
||||||
|
|
||||||
content_provider(offset, end_offset - offset, data_sink);
|
content_provider(offset, end_offset - offset, data_sink);
|
||||||
if (written_length < 0) { return written_length; }
|
if (written_length < 0) { return written_length; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user