Skip to content

Commit 0fbcc14

Browse files
committed
Ignore multiple brotli flush requests
For text_responder based handlers, brotli_output_buffer flush method was called twice: From src/process_request.cpp:210 ``` // make sure all bytes have been written. note that the writer can // throw an exception here, leaving the xml document in a // half-written state... o_formatter->flush(); out->flush(); ``` This was triggering an unnecessary assertion failure.
1 parent 564e893 commit 0fbcc14

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/brotli.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ int brotli_output_buffer::written() const { return bytes_in; }
7474

7575
int brotli_output_buffer::flush() noexcept {
7676

77-
assert(!flushed); // brotli does not support multiple flush operations
77+
if (flushed) { // brotli does not support multiple flush operations
78+
return 0;
79+
}
7880

7981
compress(nullptr, 0, true);
8082
flushed = true;

0 commit comments

Comments
 (0)