mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-26 13:31:30 +00:00
Bound the size of an SSE event
The SSE client buffered a line, or the data of an event, with no limit of its own, and with payload_max_length(0) with none at all. Add CPPHTTPLIB_SSE_MAX_EVENT_LENGTH (16MB) and end the connection with ExceedMaxPayloadSize past it.
This commit is contained in:
@@ -79,6 +79,8 @@ sse.set_max_reconnect_attempts(10);
|
||||
sse.set_headers({{"Authorization", "Bearer new_token"}});
|
||||
```
|
||||
|
||||
An event, or a line still waiting for its end, longer than `CPPHTTPLIB_SSE_MAX_EVENT_LENGTH` (16MB by default, `0` for no limit) ends the connection with `Error::ExceedMaxPayloadSize`, and the client reconnects as usual.
|
||||
|
||||
#### Control
|
||||
|
||||
```cpp
|
||||
|
||||
Reference in New Issue
Block a user