MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / parseResizeMessage

Function parseResizeMessage

src/Server/WebTerminalRequestHandler.cpp:295–307  ·  view source on GitHub ↗

Parse a control message like {"type":"resize","cols":80,"rows":24}.

Source from the content-addressed store, hash-verified

293
294/// Parse a control message like {"type":"resize","cols":80,"rows":24}.
295bool parseResizeMessage(const String & json, int & cols, int & rows)
296{
297 auto object = parseRootObject(json);
298 if (!object)
299 return false;
300 if (getStringField(object, "type") != "resize")
301 return false;
302
303 static constexpr int MAX_TERMINAL_DIMENSION = 500;
304 cols = getIntField(object, "cols", MAX_TERMINAL_DIMENSION);
305 rows = getIntField(object, "rows", MAX_TERMINAL_DIMENSION);
306 return cols > 0 && rows > 0;
307}
308
309/// Parse an auth message like {"type":"auth","user":"...","password":"..."}.
310/// The "user" field is optional: when omitted or empty, the caller-provided

Callers 1

Calls 3

parseRootObjectFunction · 0.85
getStringFieldFunction · 0.85
getIntFieldFunction · 0.85

Tested by

no test coverage detected