mattgodbolt / seasocks

Simple, small, C++ embeddable webserver with WebSockets support
BSD 2-Clause "Simplified" License
724 stars 120 forks source link

sending large HTTP responses doesn't work #187

Open mgaunard opened 1 year ago

mgaunard commented 1 year ago

Sending any HTTP response larger than 16MB leads to warning: 172.31.37.161:50082 : Closing connection: buffer size too large (16777370 >= 16777216)

Only way to fix it appears to set a very large client buffer size on the server. Clearly not a very scalable solution.

The problem seems to be due to the design that insists on copying the whole data from from the response into the connection buffer, which is then drained when the socket is ready, instead of draining the response directly.