mattgodbolt / seasocks

Simple, small, C++ embeddable webserver with WebSockets support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sending large HTTP responses doesn't work

mgaunard opened this issue · comments

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.