mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-23 11:54:42 +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:
1 parent
f5e11024da
commit
cadcc425b8
3 files changed
+44
No files matched your search
@@ -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