Use blocking mode for socket writes to ensure large response bodies
(like 1MB+ HTML pages) are fully written without EAGAIN errors. The
socket is temporarily set to blocking mode during the write operation.
Also improve error handling by logging failed sends with the message
size and error details.
Additionally, when response content claims to be text but isn't valid
UTF-8, fall back to base64 encoding instead of returning empty content.
This is to prepare for an upcoming change where we will need to track
replies to messages by ID. We will be able to add parameters to this
structure without having to edit every single actor subclass header
file.
This removes the use of StringBuilder::OutputType (which was ByteString,
and only used by the JSON classes). And it removes the StringBuilder
template parameter from the serialization methods; this was only ever
used with StringBuilder, so a template is pretty overkill here.
To aid with debugging web page issues in Ladybird without needing to
implement a fully fledged inspector, we can implement the Firefox
DevTools protocol and use their DevTools. The protocol is described
here:
https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html
This commit contains just enough to connect to Ladybird from a DevTools
client.